Returns the email of the user running the script.
class Session method .getActiveUser()
Session is the Apps Script service.
.getActiveUser() is the method name you will see after a dot in your code.
What it does
Why it's used
- Log who ran the script in an audit column.
- Personalize messages with the runner's email.
Common errors
- Forgetting parentheses on getActiveUser. Write Session.getActiveUser(), not Session.getActiveUser or getActiveUser by itself.
- Skipping dots between chained calls. Each step needs a dot, like Session.getActiveUser().
- Adding spaces where they do not belong. Write Session.getActiveUser(), not Session .getActiveUser(), Session.getActiveUser (), or Session . getActiveUser().
- Wrong capitalization. Use Session and getActiveUser, not session or getactiveuser.
Snippets using this method
Explore
Related methods
-
.getEffectiveUser()
Returns the email of the user whose permissions the script is using.
-
.getTemporaryActiveUserKey()
Returns a temporary key that identifies the current user.
-
.getScriptTimeZone()
Returns the time zone set on the script project.
More Apps Script
Better Sheets tutorials
Email Myself a Daily Random Motivational Quote
Get Every Editor on Every Google File I Own
MicroManager: Hourly Email Reminders
Simple Inventory Management Automations
Related blog posts
Written guides about Session.getActiveUser().
How I Use Google clasp to Write Apps Script with AI
Google clasp keeps your Apps Script in files on your computer, so an AI like Claude Code can read, edit and push it. My setup, my push script, and what broke.
Read post →How to Send Google Forms Entries Automatically with Apps Script
Google Forms provides basic email notifications for form submissions, but enhancing these notifications with detailed summaries can significantly improve productivity and response management.
Read post →How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →