What are Apps Script scopes in Google Sheets?

Scopes are permission strings your script requests to access Google services: read spreadsheets, send email, fetch external URLs, or read Drive files. The first time a function needs a scope, Google shows an authorization dialog. Users and admins must approve before MailApp, UrlFetchApp, or advanced APIs work in triggers and web apps.

When to use it

Understand scopes when you add services, deploy to a team, or hit Authorization required errors: know which function pulled in which scope and how to minimize scary permission screens.

When to skip it

You do not manually pick scopes in most beginner scripts. Apps Script infers them from the services you call. Focus on scopes when auditing security or Workspace admin review.

How it works

  1. 1

    Calling MailApp adds email send scope. UrlFetchApp adds external request scope. SpreadsheetApp adds spreadsheet access.

  2. 2

    Run a function manually once so the owner approves permissions before triggers run unattended.

  3. 3

    View Project Settings > Scopes in the Apps Script editor to see the list for this project.

  4. 4

    appsscript.json can declare oauthScopes explicitly for tighter control in advanced projects.

  5. 5

    Sensitive or restricted scopes may need Google OAuth verification for public add-ons.

  6. 6

    Workspace admins can block or allow certain scopes by policy.

Examples in Google Sheets

First MailApp run

User clicks Run on sendReport. Google asks to allow the script to send email on their behalf. After approval, the time trigger works overnight.

Web app visitors prompted

Deploy with Execute as User accessing the app. Each visitor grants scopes the script uses, which can feel heavy for simple tools.

Least privilege refactor

Replace GmailApp with MailApp when you only send mail, reducing requested Gmail read scopes for easier admin approval.

Build this without starting from a blank cell

Use a Better Sheets tool for Apps Script scopes, then watch a walkthrough when you want the full pattern.

Better Sheets resources

Common mistakes

  • Shipping a script to teammates who never ran authorize, so triggers fail with Authorization required.
  • Using Execute as User on a public web app, forcing every visitor through broad consent.
  • Adding advanced services you do not need, expanding scope list without reason.
  • Storing OAuth tokens wrong when mixing Apps Script auth with external APIs.
  • Assuming view-only sheet users can run installable triggers they created; ownership matters.

Frequently asked questions

Why does my script ask for permission?
It uses a Google service beyond simple triggers. Approval links your account to those scopes for this project.
How do I see which scopes a script uses?
Open Project Settings in Apps Script and review the scopes section, or inspect appsscript.json if you manage it.
Do simple onEdit triggers need authorization?
Simple triggers avoid most scopes. Calling MailApp or UrlFetchApp from onEdit still needs an installable trigger and authorization.
Can I remove a scope?
Remove the service calls that require it, save, and re authorize. Old tokens may linger until reset.
What is script.authorization?
A runtime check like getAuthorizationStatus tells you if the current user already granted needed scopes.
Why do admins block my script?
Workspace policies may deny external URL fetch, Gmail, or unverified OAuth clients. Use narrower scopes or get app verified.
Do viewers need to authorize?
Viewers running nothing need no auth. Running a custom menu or web app as User accessing the app does.
Are scopes per spreadsheet or per script project?
Per script project. Each container-bound project has its own authorization store per user.

Related Tutorials

Watch how Apps Script scopes works

Browse more tutorials
OAuth Scopes

OAuth Scopes

A little bit about how to write scopes and where to write them. For your...
Create an Internal Google Sheets Add-on

Create an Internal Google Sheets Add-on

The entire process to create and publish a Google Sheets Add-on internal...
How do I reference a different spreadsheet in Apps Script?

How do I reference a different spreadsheet in Apps Script?

I'll show you how to get text from one spreadsheet file to another with ...
What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users

What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users

Learn about triggers, hourly, daily, weekly, etc.
Scrape Google Maps

Scrape Google Maps

Scrape any query in Google Maps into your Google Sheets. Enter your API ...
Two Things to Know When Starting to Learn Google Sheets

Two Things to Know When Starting to Learn Google Sheets

Two things I would teach every beginner to immediately improve your skil...

Related blog posts

Guides that explain Apps Script scopes in more depth.

Browse the blog

Related glossary terms

Done reading about Apps Script scopes?

Membership unlocks 636+ tutorials, unlimited generators, and every template. Practical lessons. Zero fluff.

Need this once

Jump to a free tool or a single tutorial for this topic.

Learning Sheets for real

Unlock the full library, generators, and templates with membership.