Question: I am using Google Sheets and writing a custom function that takes in a range of cells as parameter and returns a string that adds a delimiting comma to the contents of the cell.

For example, we have a range `B1:B2` where cell B1 contains `"B1_contents"` and cell B2 contains `"B2_contents"`. The function should return `"B1_contents, B2_contents"`.

How can this be done in Google Sheets using Google Apps Script?

Answer: 
You can try the following:

```js
function rangeToStringSep(range, sep) {
  return range.toString().split(',').join(sep);
}

```

Use:

```js
=rangeToStringSep(B1:B3; ", ")

```

**UPDATE**

```js
function rangeToStringSep1(range, sep) {
  return range.join(sep);
}

```

![enter image description here](https://i.stack.imgur.com/IHWtY.png)
have you tried something like that ?

```
function toCommaSepStrings(values){
  return values.toString();
}

```