EN
Google Sheets - how to insert data into the last row with Apps Script (programmatically)
0
points
This article will show you how to programmatically insert data into the last row in Google Sheets (Apps Script).
Practical example
In the example below, we will use the sheet.getLastRow()
method that returns the last row of data.
Thanks to this, we know where, for example, the last row of the table is and we can insert the data into the row below.
Code used in the example:
function myFunction() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
var value = new Date(); // value you want to insert
sheet.getRange(sheet.getLastRow() + 1).setValues([value]);
}