Created
January 5, 2021 20:50
-
-
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
This file contains 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) { | |
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