Skip to content

Instantly share code, notes, and snippets.

@hhkaos
Created January 30, 2025 08:53
Show Gist options
  • Save hhkaos/9ed22518bc76aa0ae4ff564d92976106 to your computer and use it in GitHub Desktop.
Save hhkaos/9ed22518bc76aa0ae4ff564d92976106 to your computer and use it in GitHub Desktop.
Automatically update the last update date of a row in a Google Spreadsheet
function onEdit(edit) {
var row = edit.range.getRow()
var timestampTimeZone = "GMT+1"
var timestampFormat = "dd/MM/yyyy"
if( row >=2 ){
var timestamp = Utilities.formatDate(
new Date(),
timestampTimeZone,
timestampFormat)
SpreadsheetApp
.getActiveSpreadsheet()
.getRange('Comunidades!D'+row) // Change to the cell you want to update
.setValue(timestamp)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment