I read the doc for the Spreadsheet Edit Events but if I test which details are passed with a simple function:
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.toast(Object.keys(e));
}
I get source,user
Is it a bug or is the doc outdated/wrong ?
I think there’s documentation only for the on edit event when using a “installable trigger” (the one you set from the menu). The simple event handler (the one you’re testing) only receives source and user, as you noticed.
And the
e.sourceis already the active spreadsheet, so you don’t need togetActiveSpreadsheet(). And you can get the active/modified range by issuing ae.source.getActiveRange().The
userinformation is only filled if its yourself or your in a Apps domain account and also the active user.