Google Sheets Apps Script Editor: How to Open and Use

How-to basics · Updated November 3, 2026

Google Sheets Apps Script Editor: How to Open and Use

To open the Apps Script editor for a Google Sheet, open the spreadsheet in a desktop browser and select Extensions > Apps Script. The editor opens a script project connected to that spreadsheet, where you can write JavaScript to automate tasks, add custom functions, or connect the sheet to other Google services.

What the Apps Script editor does

Google Apps Script is Google’s cloud-based scripting platform. Its editor is a browser-based workspace for writing, saving, running, and managing scripts. It uses JavaScript and provides built-in services for working with Google products, including Sheets, Drive, Gmail, and Calendar. You do not install a separate program to use it.

A script can do more than a spreadsheet formula. A formula calculates a result in a cell when its inputs change; a script can carry out a sequence of actions, such as copying rows, applying formatting, creating a menu, or sending an email. Scripts can also respond to events, such as a user opening or editing a sheet, when configured appropriately.

Apps Script runs on Google’s servers, not as a macro inside a desktop spreadsheet application. That makes it useful for browser-based workflows and Google Workspace integrations, but it also means scripts are subject to Google account permissions and service quotas.

How to open it from Google Sheets

  1. Open the Google Sheets file in a desktop web browser and sign in to the Google account that can edit it.
  2. In the spreadsheet menu, choose Extensions > Apps Script.
  3. Wait for the Apps Script editor to open in a browser tab. It will normally show a project associated with the spreadsheet.
  4. Click a file in the project, such as Code.gs, to view or edit its contents. You can create additional script files from the editor’s file controls.

If you do not see the Extensions menu or cannot open the project, check whether you have permission to edit the spreadsheet. Some managed Google Workspace accounts also restrict Apps Script access through administrator settings. The Sheets mobile app does not provide the same full script-editing workflow, so use a desktop browser for authoring and debugging.

Bound scripts and standalone projects

Opening the editor through a spreadsheet usually creates or opens a container-bound script: a project attached to that particular Sheet. It is convenient because the script can refer to its container spreadsheet, add a custom menu to it, and work with its sheets without requiring you to find the file by ID first.

A standalone project is not attached to a specific spreadsheet. You can create one from the Apps Script home page or editor and have it open files by ID or other means. Standalone projects are useful for scheduled jobs or scripts intended to manage several files. They may require you to identify the target spreadsheet explicitly, and the person running the script still needs suitable access to that file.

These project types affect access and convenience, not the basic language. A bound script is associated with its spreadsheet’s sharing context, so spreadsheet editors may be able to access its script. Do not treat a script as a private place for passwords merely because its code is not visible in the grid. Review sharing settings for both the spreadsheet and the project before using sensitive information.

Writing and running a first script

A script typically contains one or more named functions. For example, this small function writes a greeting into cell A1 of the active sheet in the spreadsheet connected to the project:

function writeGreeting() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  sheet.getRange("A1").setValue("Hello from Apps Script");
}

In the editor, save the project, choose writeGreeting from the function selector, and click Run. The first run may ask you to authorize access to the services the script uses. Review the requested permissions before approving them. After it finishes, return to the spreadsheet and check A1. The editor’s execution details or log can help explain whether a run completed or failed.

This example is deliberately limited: it writes to the currently active sheet, so the result depends on which sheet is active when the function runs. For a script that must always use a particular tab, refer to that sheet by name and handle the possibility that it does not exist. Test changes on a copy or in a noncritical sheet before applying them to important data.

Useful things to automate

Apps Script is most valuable when a repeated workflow involves actions or services that formulas do not handle well. Common examples include:

  • Adding a custom menu to launch a cleanup or reporting function.
  • Formatting or reorganizing newly entered rows according to a consistent rule.
  • Creating a PDF or another file from spreadsheet data and saving it in Drive.
  • Sending a notification when a workflow reaches a defined stage, subject to authorization and email service limits.
  • Reading or updating data across several Google Sheets files.
  • Building a custom spreadsheet function for calculations that are not covered by built-in functions.

For a simple total, lookup, conditional display, or date calculation, a normal Sheets formula is usually easier to maintain. A custom function is also not a universal replacement for a formula: custom functions have restrictions, including limits on which services they can use and how they interact with the spreadsheet. Use a regular script function for actions such as sending a message or changing other cells.

Triggers, menus, and deployments

A function does not run automatically just because it exists in the editor. You can start it manually with Run, attach it to a custom menu, or configure a trigger. Simple triggers include special functions such as onOpen(e) and onEdit(e); they run in response to qualifying spreadsheet events, but have restrictions and cannot perform every action that an authorized script can.

Installable triggers are created in the Apps Script project and can run on events such as opening or editing a spreadsheet, or on a time-based schedule. They can access authorized services subject to the permissions granted, and they run under the account of the person who created the trigger. If that person loses access or their account changes, a trigger may stop working as expected. Document who owns important triggers and check them when a workflow changes hands.

The editor’s Deploy menu is for publishing certain kinds of projects, such as a web app or an add-on. You do not need to deploy a script simply to run it from the editor or use a basic trigger. A deployment can expose a program to other users, so check its access settings and the identity under which it runs before sharing its URL.

Permissions, safety, and quotas

When a script first uses a Google service that requires authorization, Google may show a consent screen describing the requested access. A script that reads spreadsheet data and one that sends email need different capabilities. Only authorize code from a source you trust, and be especially cautious with projects copied from unknown websites or shared by someone you do not know. Authorization is tied to an account; it does not mean that every other spreadsheet user has granted the same access.

Avoid placing passwords, access tokens, or other secrets directly in code that spreadsheet collaborators can view. Limit project and spreadsheet sharing to people who need it, and remove obsolete triggers or deployments. If a script acts on a file or sends messages, test with sample data and a limited audience first. Script actions that have already changed data may not be reversible with the spreadsheet’s ordinary Undo command, so keep a backup of important information.

Apps Script also enforces quotas and execution limits. The exact limits depend on the service, account type, and current Google policies, and they can change. A script that processes a very large range cell by cell or sends many emails may hit a limit or run too long. For larger tasks, work with ranges in batches, reduce unnecessary calls to Google services, and consult the current Apps Script quotas documentation for the service involved.

Common problems and how to troubleshoot

  • Extensions > Apps Script is missing: Confirm that you opened the file in Google Sheets in a browser and have edit access. If it is a managed account, ask whether the administrator allows Apps Script.
  • The editor opens the wrong project: Reopen Apps Script from the intended spreadsheet. If you have several tabs or projects open, check the project name and spreadsheet before editing or running code.
  • The function does not appear in the Run selector: Save the project, confirm the function is declared at the top level, and fix any syntax errors that stop the file from parsing.
  • Authorization or access errors appear: Check which account is signed in, whether it can access the target file, and whether the requested permissions were granted. A project’s authorization can also need attention after its code or services change.
  • A trigger does not run: Check that the trigger exists, that it is configured for the intended spreadsheet and event, and that its creator still has access. Review the project’s execution history for error details.
  • The script is slow or stops partway through: Look for repeated calls inside loops, large data ranges, service quotas, or execution limits. Read and write blocks of data where practical rather than making a separate service call for every cell.

For debugging, use the editor’s execution history and logging tools to find the failed function and error message. Add small checks that confirm expected sheet names or input values, then test with a small data set. An error message is more useful than repeatedly running a script without changing or inspecting anything.

Apps Script versus formulas and Excel

Choose a Sheets formula when the goal is to calculate a value that should update as cell inputs change. Choose Apps Script when you need a sequence of actions, a custom menu, event-driven behavior, or a connection to a Google service. A spreadsheet can use both: formulas can handle row-level calculations while a script handles a one-click export or scheduled task.

Apps Script is specific to Google’s platform. It is not VBA, and it does not run as an Excel macro. Excel has its own automation options, including Office Scripts and VBA, with different languages, permissions, and compatibility. If a workflow must move between Google Sheets and Excel, plan for a separate implementation rather than assuming an Apps Script project will transfer.

Frequently Asked Questions

Is Apps Script free to use with Google Sheets?
There is generally no separate purchase required just to open the editor and write a script, but Google services have quotas and account-specific limits. Check Google’s current Apps Script documentation for the limits that apply to your account and the services your project uses.

Can I open the Apps Script editor on my phone?
The full editing experience is intended for a desktop browser. The Google Sheets mobile app does not offer the same complete editor workflow, so use a computer browser to create, edit, and debug scripts.

Does a script run automatically when I open a spreadsheet?
Not by default. You must run a function manually or set up an appropriate menu or trigger. A simple onOpen(e) function can respond to qualifying opens, but it has restrictions and is not the same as granting a script unlimited background access.

Can an Apps Script change cells without a formula?
Yes. A script can read or write spreadsheet ranges through the Sheets service, provided it has the needed access. Unlike a formula, a script changes the sheet as an action; it does not necessarily recalculate automatically whenever an input cell changes.

Why does Google ask me to authorize a script?
Authorization allows a script to use Google services on your account’s behalf. Review the requested access and approve it only if you trust the project and understand what it needs to do.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.