user3456352
user3456352

Reputation: 95

onEdit function not showing user name

I have a simple script:

function onEdit(e){
var name = Session.getActiveUser();
var range = e.range;
range.setNote('Last modified: ' + new Date()+"By:"+" "+name);
}

The results are like this:

Last modified: Wed Dec 17 2014 15:50:24 GMT-0500 (EST)By: 

But there is just a blank where the User's name should be... thoughts?

Upvotes: 1

Views: 1023

Answers (1)

rckrd
rckrd

Reputation: 3344

The script needs authorization to be able to execute Session.getActiveUser(). Your code above works for me if I first run the script in the editor and authorize it, then the note with the user info is added to the cells on edit.

Upvotes: 1

Related Questions