Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active December 28, 2015 04:49
Show Gist options
  • Save tkuchiki/7445719 to your computer and use it in GitHub Desktop.
Save tkuchiki/7445719 to your computer and use it in GitHub Desktop.
Google Apps Script (Spreadsheets). Get last row number.
function retrieveLastRow() {
return SpreadsheetApp.getActiveSheet().getLastRow();
}

sheet

A B
1 data1 data2
2 data3 data4
3
4

result

SpreadsheetApp.getActiveSheet().getRange('A4').setValue(retrieveLastRow());

A B
1 data1 data2
2 data3 data4
3
4 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment