Skip to content

Instantly share code, notes, and snippets.

@dmitri-lerko
Created January 5, 2021 20:50
Show Gist options
  • Save dmitri-lerko/4b61ade1fbb51f4d821e4f7c15941073 to your computer and use it in GitHub Desktop.
Save dmitri-lerko/4b61ade1fbb51f4d821e4f7c15941073 to your computer and use it in GitHub Desktop.
Auto-populate a column with timestamp when a new row is added
function onEdit(e) {
var row = e.range.getRow();
var col = e.range.getColumn();
if(col === 2 && e.source.getActiveSheet().getName() === "help_requests") {
if(e.source.getActiveSheet().getRange(row, 1).getValue() == "") {
e.source.getActiveSheet().getRange(row, 1).setValue(new Date());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment