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

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about Session.getActiveUser().

Browse the blog