1
votes

I'm using Google Sheets API v4[1] to manipulate a Spreedsheet using Java Script Client API[2].

How can I add a new row without using the range property of the spreadsheets.values.update method [3]. Is this the only way to add rows using Google Java Script client API?

I just want to add a new row to the end (after last non-empty) of an existing sheet.

Using the rowCount or endRowIndex properties from the sheet object [4] is not an option because I want to add after the last non empty row.

[1] https://developers.google.com/sheets/reference/rest/

[2] https://developers.google.com/sheets/quickstart/js

[3] https://developers.google.com/sheets/reference/rest/v4/spreadsheets.values/update

[4] https://developers.google.com/sheets/reference/rest/v4/spreadsheets#sheet

1

1 Answers

2
votes

You can append new row after your last row by using the AppendCellsRequest of the Spreadsheet collection:

https://developers.google.com/sheets/reference/rest/v4/spreadsheets/request#appendcellsrequest