Basics
Apps Script basics
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.
- Run your first Apps Script functionYour first script, from opening the editor to reading its output. You replace the starter function, save, click Run, and read what Logger.log printed in the Execution log.
- 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.
- Bound scripts and standalone scriptsEvery Apps Script project is either attached to one Google file or standing on its own. The kind of project affects how your code opens files, who can see the code, and where you find it later.
- Google Apps Script triggers explainedGoogle Apps Script triggers run functions automatically when a file opens, a cell changes, a form is submitted, or a scheduled time arrives. Use a simple onEdit or onOpen for work in the bound file. Choose an installable trigger for a schedule, form submission, or work that needs authorization.
- 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.
- Rows, columns, and 2D arrays in Sheets scriptsA range is a rectangle of cells. getValues() returns that rectangle as an array of rows, and each row is an array of cell values.
- Custom functions in Google SheetsA custom function runs from a cell formula. Each call has 30 seconds, receives cell values instead of ranges, and cannot use your personal data or edit other cells.
- Common Apps Script errors and what they meanApps Script error messages say what failed, for example TypeError: Cannot read properties of null (reading 'getRange') or ReferenceError. Find the exact message below for its cause and fix.
- 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.
- 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.