onOpen(e) - Runs automatically when a user opens a file that the user has permission to edit.
Note for Google Forms: This event doesn't occur when a user opens a form to respond, but rather when an editor opens the form to modify it. See here.
onInstall(e) - Runs automatically when a user installs an Editor Add-on from within a file.
onEdit(e) - Runs automatically when a user changes a value in a spreadsheet.
onSelectionChange(e) - Runs automatically when a user changes the selection in a spreadsheet. To work on mobile devices requires the spreadsheet to also be open in desktop browser.
doGet(e) - Runs automatically when a user visits a web app or a program sends an HTTP GET request to a web app.
doPost(e) - Runs automatically when a user visits a web app or a program sends an HTTP GET request to a web app.
Because simple triggers fire automatically, without asking the user for authorization, they are subject to several restrictions:
They cannot run for longer than 30 seconds.
The script must be container-bound to a Google Sheets, Slides, Docs, or Forms file, or else be an add-on that extends one of those applications.
They do not run if a file is opened in read-only (view or comment) mode.
Script executions and API requests do not cause triggers to run. For example, calling Range.setValue() to edit a cell does not cause the spreadsheet's onEdit trigger to run.
They cannot access services that require authorization. For example, a simple trigger cannot send an email because the Gmail service requires authorization, , but a simple trigger can translate a phrase with the Language service, which is anonymous.
They can modify the file they are bound to, but cannot access other files because that would require authorization.
They may or may not be able to determine the identity of the current user, depending on a complex set of security restrictions.
In certain circumstances, Editor add-ons run their onOpen(e) and onEdit(e) simple triggers in a no-authorization mode that presents some additional complications. For more information, see the guide to the add-on authorization lifecycle.
Simple triggers are subject to Apps Script trigger quota limits.
📌 Note: These restrictions do not apply to doGet(e) or doPost(e).
Installable triggers always run under the account of the person who created them. For example, if you create an installable open trigger, it runs when your colleague opens the document (if your colleague has edit access), but it runs as your account. This means that if you create a trigger to send an email when a document is opened, the email is always sent from your account, not necessarily the account that opened the document. However, you could create an installable trigger for each account, which would result in one email sent from each account.
Even though installable triggers offer more flexibility than simple triggers, they are still subject to several restrictions:
They cannot run for longer than 6 minutes.
They don't run if a file is opened in read-only (view or comment) mode. For standalone scripts, users need at least view access to the script file in order for triggers to run properly.
Script executions and API requests do not cause triggers to run. For example, calling FormResponse.submit() to submit a new form response does not cause the form's submit trigger to run.
Note: An exception to this restriction is Form.submitGrades(). If your code uses an onFormSubmit trigger, calling Form.submitGrades() triggers the onFormSubmit condition and causes an infinite loop. To prevent the infinite loop, add code that checks whether grades already exist before calling submitGrades().
Installable triggers always run under the account of the person who created them. For example, if you create an installable open trigger, it runs when your colleague opens the document (if your colleague has edit access), but it runs as your account. This means that if you create a trigger to send an email when a document is opened, the email is always sent from your account, not necessarily the account that opened the document. However, you could create an installable trigger for each account, which would result in one email sent from each account.
A given account cannot see triggers installed from a second account, even though the first account can still activate those triggers.
Installable triggers are subject to Apps Script trigger quota limits.
About "On change"
The "On change" event type is only available as an installed trigger.
The "On change" event type runs when the spreadsheet's content or structure is changed.
Simple triggers have reserved function names, like onOpen, onEdit, onSelectionChange, and onInstall.
Installable triggers don't have reserved function names.
onChange is an arbitrary name given to the an installed trigger configured with the "On change" event type.
In an "On change" trigger in Apps Script, getActiveSheet() will return the first sheet in the workbook because the trigger doesn't associate with a user-initiated action that sets an active sheet.
"On change" installable triggers don't have e.range, or e.value event objects. See here.
onEdit(e) simple triggers have e.range, and e.value event objects. See here.
About "On form submit"
The "On form submit" event type is only available as an installed trigger.
The "On form submit" event type runs when a form response is sent by a form to a spreadsheet.
Simple triggers have reserved function names, like onOpen, onEdit, onSelectionChange, and onInstall.
Installable triggers don't have reserved function names.
onSubmit and onFormSubmit are arbitrary names given to the an installed trigger configured with the "On form submit" event type.
"On form submit" installable triggers container-bound to Forms have e.response event objects, but don't have e.range or e.values event objects. See here.
"On form submit" installable triggers container-bound to Sheets have e.range, and e.values event objects, but don't have e.response event objects. See here.
Enum EventType (for installed triggers)
CLOCK - The trigger fires once the time-driven event reaches a specific time.
ON_OPEN - The trigger fires once the user opens the Google Docs, Sheets, or Forms file.
ON_EDIT - The trigger fires once the user edits the Google Sheets file (for example, by entering a new value into a cell, which counts as an edit instead of a change).
ON_FORM_SUBMIT - The trigger fires once the user responds to a Google Form. This trigger is available either in the Google Form itself or in the Google Sheets file that the form sends its responses to.
ON_CHANGE - The trigger fires when changes are made to the Google Sheets file (for example, by adding a row, which counts as a change instead of an edit).
ON_EVENT_UPDATED - The trigger fires once an event gets created, updated, or deleted on the specified Google Calendar.
e.changeType (for events in functions that have "On change" installed triggers)
EDIT - Any change to cell values, cell borders, cell merges, inserting image in-cell.
FORMAT - Any changes to cell value format, font colour, background colours.
INSERT_ROW - When a new row is added.
REMOVE_ROW - When an existing row is removed.
INSERT_COLUMN - When a new column is added.
REMOVE_COLUMN - When an existing column is removed.
INSERT_GRID - When a new sheet/tab is added.
REMOVE_GRID - When an existing sheet/tab is removed.
OTHER - Renaming a sheet, inserting charts, inserting image over-cells, adding/editing notes, adding/replying to comments, recalculating IMPORTRANGE formulas.
ATTENTION: Because formula recalculation causes "OTHER" to be detected, even when no values have changed, you must supplement with other checks so as to prevent the apps script from processing unnecessarily.
Can be run from the apps script editor.
Can be deployed as a web app.
Can be run automatically from an installable trigger.
Examples where "On Change" installed triggers have been the suggested for edits enacted by external sources: