Triggers are the backbone of automation in Apps Script. Instead of running a function manually, triggers automatically execute your code in response to an event — a user opening a sheet, editing a cell, submitting a form, or a scheduled time being reached.
Types of Triggers
Simple Triggers
Simple triggers are reserved function names that Apps Script automatically invokes when a matching event occurs. No setup is required — just name your function correctly:
| Function Name | Fires When |
|---|---|
onOpen(e) | A spreadsheet, doc, or form is opened |
onEdit(e) | A cell is edited in a spreadsheet |
onFormSubmit(e) | A Google Form is submitted |
onSelectionChange(e) | The cell selection changes |
Simple triggers run with limited permissions and cannot send emails, access external services, or modify files outside the current document.
Installable Triggers
Installable triggers offer more power — they run with the full permissions of the user who created them and can fire on the same events as simple triggers plus time-based schedules.
They must be set up either through the Apps Script UI (Triggers menu) or programmatically using ScriptApp.
Simple Trigger Example
Installable Trigger Example
Choosing Between Simple and Installable
| Simple Triggers | Installable Triggers | |
|---|---|---|
| Setup required | None | Yes (script or UI) |
| Email/external access | No | Yes |
| Time-based scheduling | No | Yes |
| Run as | Current user (limited) | Trigger owner |
| Timeout | 30 seconds | 6 minutes |
The Event Object
Most trigger functions receive an event object e with context about what happened:
For the Sales Tracker, e.range tells you exactly which cell was changed, e.value gives the new value, and e.oldValue gives what was there before.