Q:

In google app script how google is choosing the account in which the doc must be created

I am creating a google app script which will create a google doc in user's drive.
In case, when a user is signed in to google using multiple account, how does app script determines which account it is being accessed from.
Thanks for the help.

A:

Session.getActiveUser().getEmail()

This won't work if the user is signed in with a gmail account though.
https://developers.google.com/apps-script/reference/base/user

