Automating Date Updates in Google Sheets with Apps Script
2 min readSep 16, 2023
If you’ve ever used Google Sheets for collaborative work or data tracking, you’ve probably wished for a way to timestamp when changes were made to your data automatically. Well, the good news is, you can achieve just that using Google Apps Script. In this article, we’ll break down a simple yet powerful script that adds dates to your Google Sheet whenever an edit is made, making your data history crystal clear.
Step 1: Open the Editor
Then you will see:
Step 2: Paste the code and save
function onEdit() {
var sheet = SpreadsheetApp.getActive().getSheetByName('demo');
var activeCell = sheet.getActiveCell();
var row = activeCell.getRow();
var time = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy");
if (activeCell.getColumn() != 1 && row != 1) {
sheet.getRange('A' + row.toString()).setValue(time);
}
}