How to get the last row with value in the new Google Sheets API v4 ?
i use this to get a range from a sheet:
mService.spreadsheets().values().get("ID_SHEET", "Sheet1!A2:B50").execute();
how to detect the last row with value in the sheet ?
How to get the last row with value in the new Google Sheets API v4 ?
i use this to get a range from a sheet:
mService.spreadsheets().values().get("ID_SHEET", "Sheet1!A2:B50").execute();
how to detect the last row with value in the sheet ?
I managed to get it by counting the total rows from current Sheets. Then append the data to the next row.
You can set the range to "A2:D" and this would fetch as far as the last data row in your sheet.
You don't need to. Set a huge range (for example
A2:D5000
) to guarantee that all your rows will be located in it. I don't know if it has some further impact, may be increased memory consumption or something, but for now it's OK.Look at the loop
for (List row : values)
. If you have two rows in your table you will get two elements invalues
list.