Skip to content

Instantly share code, notes, and snippets.

@ttsukagoshi
Last active September 24, 2020 02:08
Show Gist options
  • Save ttsukagoshi/97a3952e13f54150e4062bee593e975e to your computer and use it in GitHub Desktop.
Save ttsukagoshi/97a3952e13f54150e4062bee593e975e to your computer and use it in GitHub Desktop.
Automatically enter the timestamp for the latest update on the current Google spreadsheet.
const RECORDING_SHEET_NAME = 'SHEET_NAME'; // Sheet name to record the timestamp.
const RECORDING_CELL = {'row': 2, 'column': 2}; // Row and column number of the cell to record the timestamp.
/**
* Automatic timestamp for the latest update on this spreadsheet.
*/
function onEdit() {
var now = new Date();
var timestamp = now.toISOString();
SpreadsheetApp.getActiveSpreadsheet()
.getSheetByName(RECORDING_SHEET_NAME)
.getRange(RECORDING_CELL.row, RECORDING_CELL.column)
.setValue(timestamp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment