I've got a Google apps script project running on a Google site. The site requires users to sign in, and it only open to users on this G-suite domain.
The scripts I have are for allowing users to do voting, get into a queue of speakers, and some other tasks.
Currently all the functions in the background would work fine running as "Me" which I prefer, however I need to know the e-mail address of the user running the script (viewing the Google site). Is there any way for me to get the e-mail address of the signed in user viewing the page that is running the script, while running the actual script as me?
If not, can I have one script run as the user, then call another script that runs as me?
have you tried logging these? https://developers.google.com/apps-script/reference/base/session#getActiveUser()
// Log the email address of the user under whose authority the script is running.
var email = Session.getEffectiveUser().getEmail();
Logger.log(email);
// Log the email address of the person running the script.
var email = Session.getActiveUser().getEmail();
Logger.log(email);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With