Last active
April 30, 2023 11:17
-
-
Save awaism551/9d854515016d2521e8808fc800049a42 to your computer and use it in GitHub Desktop.
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) { | |
try { | |
if(e) { | |
var range = e.range; | |
var column = range.getColumn(); | |
var row = range.getRow(); | |
Logger.log(row) | |
if (column == 2) { | |
var sheet = range.getSheet(); | |
var now = new Date(); | |
var formattedDate = Utilities.formatDate(now, sheet.getParent().getSpreadsheetTimeZone(), "yyyy-MM-dd hh:mm:ss a"); | |
sheet.getRange(row, 1).setValue(formattedDate); | |
} | |
} | |
} catch (error) { | |
Logger.log(error); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
code block you can use in google docs Apps script section whenever you want to update one column on update of second column