I'm working with Google Script and spreadsheets but I can't seem to get what I need.
So far, I was retrieving data from an API and appending it to the end of the list. However now I am doing an optimisation to only add the new data.
This way I am:
Detecting how many new rows I need to add
Adding the new data at the beginning.
I am doing this by adding new rows at the beginning of the document (as many as I have new elements) and updating those new rows with the obtained data. However, I am not able to do this last part.
I can't find an example of the correct syntax of Google Sheets API v4 with Google Script and it's difficult to see where I'm going wrong.
Right now what I have is the following:
Where:
: This is the id of the spreadsheet.
: This is the number of new rows I need to add.
: This is an array that has the new fields.
The method calls a function that does the following:
As only works if both methods work, I am now getting the following error:
I know that the first part works because if I just run the first , it enters as many rows as I have new elements. So I go from
A
B
1
test1
test1
2
test2
test2
to (assuming that I have three new elements)
A
B
1
test1
test1
2
test2
test2
I know there must be some detail I'm missing, but I can't seem to translate the documentation into an example applicable to Google Script.
Thank you very much for your help.
View on Stack Overflow
