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

Returns the email of the user running the script.

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.

Explore

Related methods

Better Sheets tutorials

Email Myself a Daily Random Motivational Quote

Email Myself a Daily Random Motivational Quote

Quickly make a daily email to myself with a motivational quote.
Get Every Editor on Every Google File I Own

Get Every Editor on Every Google File I Own

Get every editor if you're looking for the sheets and documents you've s...
MicroManager: Hourly Email Reminders

MicroManager: Hourly Email Reminders

I'll show you how to set up a super powered checklist that can act like ...
Simple Inventory Management Automations

Simple Inventory Management Automations

Create a few simple automations like email notifications and low stock a...

Related blog posts

Written guides about Session.getActiveUser().

Browse the blog