user7331530
user7331530

Reputation: 975

How to set multiple values on next row in Google Apps Script

Row after last row with the data in the spreadsheet var nextRow = SpreadsheetApp.getActiveSheet().getDataRange().getLastRow()+1;

Five values
var values = [[val1, val2, val3, val4, val5]];

I want to add above five values in column A to E to next row and doing following does not work(Getting error: Incorrect range height, was 1 but should be 993) SpreadsheetApp.getActiveSheet().setActiveSelection("A:E"+ nextRow).setValues(values);

Upvotes: 1

Views: 2151

Answers (1)

technomage
technomage

Reputation: 10069

Might be safer to obtain the Range you want rather than setting and depending on a selection.

Your range specifier is "A:E" + nextRow, but should probably be "A"+nextRow+":E"+nextRow. The former is likely giving you more than a single row.

Upvotes: 1

Related Questions