The range in my Google Spreadsheet looks like this:
| A | B | C | D | E | F |
|-------------------|-----|-------------------|-----|-----------------|-----|
| Cersei, Lannister | 111 | Finger, Little | 112 | | |
| Cooper, Sheldon | 222 | | | | |
| White, Walter | 331 | Ehrmantraut, Mike | 332 | Pinkman, Jessie | 333 |
I'd like to get a jagged array for my user-defined function, that would look like this:
array = [
["Cersei, Lannister 111", "Finger, Little 112"],
["Cooper, Sheldon 222"],
["White, Walter 331", "Ehrmantraut, Mike 332", "Pinkman, Jessie 333"]
]
I wanted to get there by doing things with separate array elements (e.g. using splice in a while loop so I can get pairs of cells, name + number).
But it seems that it will take all the cells within each row and join them into one string element. So the result is something like
["Cersei, Lannister 111,Finger, Little 112", "Cooper, Sheldon 222", "White, Walter 331,Ehrmantraut, Mike 332,Pinkman, Jessie 333"]
So then when I for instance use input.join("-") it will put the delimiter at the end of each original row, between 112 and Cooper for instance, instead of between the original spreadsheet cells (between Lannister and 111, 111 and Finger and so on).
How do I import the range into the function to get separate cells as array elements?