Skip to content

Basics

The ideas behind every Apps Script

Read these in order the first time, then come back to one when a guide mentions it. Each page takes a few minutes and ends with the tasks that use the idea.

Reading order

Start at the top

Pages later in the list assume the earlier ones.

  1. Run your first Apps Script functionOpen Extensions > Apps Script from a Google Sheet or Doc to reach the code editor. Replace the starter function myFunction() { }, save with Ctrl+S, press Run, and read what Logger.log printed.
  2. Apps Script permissions and authorizationBefore a script can read your sheet or send your mail, you give it permission to access a list of OAuth scopes. This page walks through each authorization screen, explains @OnlyCurrentDoc, and shows how to revoke access.
  3. Bound scripts and standalone scriptsEvery Apps Script project is either attached to one Google file or standing on its own. The choice decides how your code reaches your data, who can see it, and where you find it later.
  4. Google Apps Script triggers explainedA Google Apps Script trigger runs a function when an event happens, without pressing Run. Simple triggers like onEdit and onOpen need no setup, while installable triggers run on a schedule or form submit using the OAuth scopes approved by their owner.
  5. Execution log, Logger.log, and debuggingMost Apps Script debugging is printing a value with Logger.log or console.log and reading the error line. This page shows where the output goes and how to trace a failure.
  6. Rows, columns, and 2D arrays in Sheets scriptsA range is a rectangle of cells. getValues() hands you that rectangle as an array of rows, and each row is an array of cell values.
  7. Custom functions in Google SheetsA Google Sheets custom function runs in a silent sandbox with its own rules: 30-second timeouts, raw 2D arrays instead of Range objects, no personal services, and no cell edits.
  8. Common Apps Script errors and what they meanApps Script error messages name the failure directly, from TypeError: Cannot read properties of null (reading 'getRange') to ReferenceError and quota limits. Find the exact message below for the cause and fix.
  9. Dates, time zones, and Utilities.formatDateA Date holds one instant in time. Use Utilities.formatDate(date, timeZone, pattern) and Session.getScriptTimeZone() to format it in the right time zone.
  10. Google Apps Script quotas and limitsGoogle caps how long one run may take and how much your scripts may do in a day. Knowing the caps changes how you write anything that touches a lot of rows.

Ready to build something?

Choose a task guide

Browse task guides