I looking for script, that will create audit log in another sheet. In this log it should be:
1)Time stamp 2)User who edited cell 3)The value of the edited cell
I tryed many of tutorial, but I am really new in this and little lost.
I looking for script, that will create audit log in another sheet. In this log it should be:
1)Time stamp 2)User who edited cell 3)The value of the edited cell
I tryed many of tutorial, but I am really new in this and little lost.
This script will log all activities in the sheet "Logging"
function onEdit(e) {
var email = Session.getEffectiveUser().getEmail();
var timeZone = Session.getScriptTimeZone();
var key = Session.getTemporaryActiveUserKey();
var sName = e.source.getActiveSheet().getSheetName();
if(sName !== "Logging") {
var value;
var mA1 = e.range.getA1Notation().split(":")[0];
if(typeof(e.value) == 'string') {
var aCell = e.source.getRange(mA1);
value = aCell.getValue();
var form = "'" + aCell.getFormula();
} else {
value = e.value;
}
var data = [sName, mA1, timeZone, email, key, value, form];
e.source.getSheetByName("Logging").appendRow(data);
}
}