Skip to content
Advertisement

How to push 1 D array to a column

I’m trying to push 1D array to a column but Im keep getting that error “Exception: The parameters (number[]) don’t match the method signature for SpreadsheetApp.Range.setValues.” which what I understood is that I cant use setValues for 1D array, it has to be 2D array or more.

Here is my code.

JavaScript

I tried to add

JavaScript

before the setValues statement but it didn’t work as well

If you need more info please let me know.

Thank you

Advertisement

Answer

Basically you need to convert your 1D array into 2D array to put it into a column. It can be done this way:

JavaScript

For your case the last line could be something like this:

JavaScript

But I don’t know if your array is a valid array and what the range you want to fill. Probably in your case the array is not array at all.

Could you show the contents of the array results?

JavaScript

Because this operation looks extremely weird:

JavaScript

I frankly don’t understand what you’re trying to gain.

Perhaps there shouldn’t be the brackets [...]:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement