Created
August 4, 2023 16:42
-
-
Save empeje/db4997c0040139454ca7004c473c5015 to your computer and use it in GitHub Desktop.
App Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onEdit(e) { | |
updateTimestamp(e) // modularize in separate function and add it in the onEdit hook | |
} | |
function updateTimestamp(e) { | |
var ss=SpreadsheetApp.getActiveSpreadsheet(); | |
if(ss.getSheetName() === "Jobs") { // change your sheet name here | |
ss.setCurrentCell(ss.getRange(`C${ss.getActiveCell().getRow()}`)) // change C to something else if the column is different | |
var activeCell = ss.getCurrentCell() | |
var now = new Date() | |
console.log(`Set date to ${now.toDateString()}`) | |
activeCell.setValue(now.toDateString()) | |
ss.setCurrentCell(ss.getActiveCell()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment