Skip to content

Instantly share code, notes, and snippets.

@Tocacar
Created May 31, 2019 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tocacar/9215bf75727e13b29f6013013c3d0973 to your computer and use it in GitHub Desktop.
Save Tocacar/9215bf75727e13b29f6013013c3d0973 to your computer and use it in GitHub Desktop.
function onEdit(e) {
new Date().toLocaleString("en-GB", {timeZone: "Europe/London"})
var user = Session.getActiveUser().getEmail();
var oldValue = e.oldValue
var sName = e.source.getActiveSheet().getSheetName();
if(sName == "Standards Assurance Table") {
var mA1 = e.range.getA1Notation().split(":")[0];
var timedate = new Date();
var timestamp = Utilities.formatDate(timedate, 'Europe/London', 'yyyy-MM-dd HH:mm:ss Z');
if(typeof(e.value) == 'string') {
var aCell = e.source.getRange(mA1);
var value = aCell.getValue();
var form = "'" + aCell.getFormula();
} else {
value = e.value;
}
var data = [timestamp, user, mA1, oldValue, value];
e.source.getSheetByName("Change Log").appendRow(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment