I created an add-on for Google spreadsheets.
Everytime it runs, it must check the user's email address
Session.getActiveUser().getEmail();
Therefore, I created an onOpen trigger to fetch the email address, but it seems this isn't possible according to Google's documentation here.
Then, how do I use the User Class?
This is how the functon to get the email looks like:
function myFunction() {
var userEmail=Session.getActiveUser().getEmail();
Browser.msgBox("Your email address is "+userEmail);
}
I tried so getEffectiveUser()
but it gives the developer's email address instead.
I tried sharing the spreadsheet with a second user, he gave permission to show the email bit no matter what I do I always get an empty string!
I need this app to check if the user's email is on a list of another spreadsheet.