Skip to content

Instantly share code, notes, and snippets.

@awaism551
Last active April 30, 2023 11:17
Show Gist options
  • Save awaism551/9d854515016d2521e8808fc800049a42 to your computer and use it in GitHub Desktop.
Save awaism551/9d854515016d2521e8808fc800049a42 to your computer and use it in GitHub Desktop.
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);
}
}
@awaism551
Copy link
Author

code block you can use in google docs Apps script section whenever you want to update one column on update of second column

@awaism551
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment