Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Table - trigger for log timestamp of cell changes
/**
* Set updatedAt for Popis column
* @autor
* přejmenováno na onEditTrigger a nastaveno přes Zdorje/Spouštěče == zná to i email editora
* @see https://developers.google.com/apps-script/guides/triggers/
*/
function onEdit(e) {
var range = e.range;
// column number
var col = range.getLastColumn();
// comment all cells now
if( true || col == 3 || col == 8 || col == 9){
var email = "";
try{
email = Session.getActiveUser().getEmail();
email = email ? ('/'+email) : '';
}catch(e){}
var d = new Date();
var dStr = d.getFullYear()+""+(d.getMonth()+1)+""+d.getDate()+" "+d.getHours()+":"+d.getMinutes()
range.setNote(range.getNote() + "\nUpd: " + dStr + email);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.