a-marenkov/gsheets

How to appendRow multiple times?

Closed this issue · 3 comments

Hello, i need to append multiple data in a single time, so i need to call appendRow in a loop. But, in the google sheet, i see that only one row being appended. Is this some kind of issue?

thanks, btw great project, very helpful

Hi @aldhosutra

If you would like to append multiiple rows, you should use appendRows.

Regarding your issue - most likely you've forgot to add await keyword.

for/while loop {
   await sheet.values.appendRow(values);
}

But you should avoid using loops - there is going to be a request for each iteration.

Thanks for checking out gsheets!

Here is an example

final values = [
['a', 'b', 'c'],
['1', '2', '3'],
['a1', 'b2', 'c3'],
];

await sheet.values.appendRows(values);

Hello,
your code works perfectly

thanks, this is a great library, great help!