checkMultipleAccount
function checkMultipleAccount(email: string): boolean;
Signed in to several Google accounts in one browser, a person can trigger a script that then runs as another of their accounts — and writes, shares or mails as that one. Comparing the initiator's address with the effective user's is what catches it, so the script can say so instead of doing something surprising.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The address of the person who triggered the script. |
Returns
boolean — true when the two addresses differ.
Throws
Exception | Condition |
|---|---|
| either address is missing or malformed. |
Examples
In use
function onOpen(event) {
if (checkMultipleAccount(event.user.getEmail())) {
SpreadsheetApp.getUi().alert("You are signed in to more than one Google account.");
}
}
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.