Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amccloud/8ddd67df963206bc28dfe841863b2629 to your computer and use it in GitHub Desktop.
Save amccloud/8ddd67df963206bc28dfe841863b2629 to your computer and use it in GitHub Desktop.
function onEdit(e) {
const now = new Date();
const utcNow = new Date(Date.UTC(
now.getUTCFullYear(),
now.getUTCMonth(),
now.getUTCDate(),
now.getUTCHours(),
now.getUTCMinutes(),
now.getUTCSeconds(),
now.getUTCMilliseconds()
));
var sh = e.source.getActiveSheet();
if (sh.getName() == 'Sheet1' && e.range.getColumn() == 1 && e.range.getRow() != 1) {
sh.getRange(e.range.rowStart, 2).setValue(utcNow)
}
if (sh.getName() == 'Sheet1' && e.range.getColumn() == 3 && e.range.getRow() != 1) {
sh.getRange(e.range.rowStart, 4).setValue(utcNow)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment