Languages
[Edit]
EN

Google Sheets - how to insert data into the last row with Apps Script (programmatically)

0 points
Created by:
jonrsharpe
436

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.

Google Sheets - how to add checkbox

 

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]);
}

Alternative titles

  1. Google Excel - how to insert data into the last row
  2. Google Sheets - how to insert data into the last row using Scripts
  3. Google Sheets - how to insert data into the last row (programmatically)
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Google Sheets

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join