0

I would like to write some data to a spreadsheet using setValues function. Runing the code below return the message: "Exception: The parameters (number[]) don't match the method signature for SpreadsheetApp.Range.setValues."

var ss= SpreadsheetApp.openByUrl(ss_url);
var ws = ss.getSheetByName("Liste");
 var data=["1","2", "3", "4"];
ws.getRange(2,5,1,4).setValues(data);
  • 1
    The argument of `setValues(values)` is required to be 2 dimensional array. [Ref](https://developers.google.com/apps-script/reference/spreadsheet/range#setvaluesvalues) So, please modify `var data=["1","2", "3", "4"];` to `var data=[["1","2", "3", "4"]];` and test it again. But, when the values of `ss_url` and the sheet name are invalid, an error occurs. Please be careful this. – Tanaike Dec 29 '21 at 08:10
  • 2
    Welcome. I'm glad your issue was resolved. I thought that I found the same question. So I flagged this as a duplicated question. – Tanaike Dec 29 '21 at 08:19

0 Answers0