BlackTea
BlackTea

Reputation: 1274

Google Spreadsheet Script - does not record user email

In my Google Spreadsheet I log last modification of cell in each row.

When I edit cells from my account it records my user (as email), when somebody makes a edit from other account it shows empty user name or ?.

Here goes Google script.

function onEdit(e) {
...
  ss.getRange(r.getRow(), ss.getLastColumn()).setValue(e.user.getEmail() + " " + date + " \"" + column_name + "\"");
...
}

Result when I edit:

*******@gmail.com 11:09 [08-11-2012] "SOME VALUE"

Result when somebody else edits:

? 09:54 [08-11-2012] "SOME VALUE"

Upvotes: 3

Views: 1864

Answers (1)

Brian Henry
Brian Henry

Reputation: 3171

The documentation doesn't appear to address this directly. In theory, that event should be returning the owner of the spreadsheet (which may not be what you want anyway, if you are trying to create an audit trail).

It certainly seems like the acting of a deliberate security policy, based on precedent set in the description of getActiveUser here. I suppose you could try accessing the user in the various ways provided by Session, and see if you have better luck.

Upvotes: 3

Related Questions