0
0
Google Sheetsspreadsheet~10 mins

Triggers (onEdit, onOpen) in Google Sheets - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

A simple score table with names and scores.

CellValue
A1Name
B1Score
A2Alice
B285
A3Bob
B390
A4Charlie
B478
Formula Trace
onEdit(e) and onOpen() are Google Sheets triggers that run scripts automatically when you edit a cell or open the spreadsheet.
Step 1: User edits cell B2 from 85 to 88
Step 2: Script reads the edited cell B2 value (88)
Step 3: Script updates cell C2 with 'Updated!'
Step 4: User opens the spreadsheet
Step 5: Script adds a custom menu 'My Menu' to the spreadsheet UI
Cell Reference Map
Name
Alice
Bob
Charlie
Cells A1:B4 hold data. Cell B2 is edited triggering onEdit. Cell C2 is updated by script. onOpen affects the whole spreadsheet UI.
Result
   A       B       C
1 Name    Score   
2 Alice   88     Updated!
3 Bob     90     
4 Charlie 78     

Menu: 'My Menu' appears in toolbar
After editing B2 to 88, cell C2 shows 'Updated!'. When the sheet opens, a custom menu 'My Menu' appears in the toolbar.
Sheet Trace Quiz - 3 Questions
Test your understanding
What event causes the onEdit trigger to run?
AWhen a user changes a cell value
BWhen the spreadsheet is opened
CWhen a formula recalculates
DWhen a new sheet is added
Key Result
Triggers like onEdit and onOpen run scripts automatically on user actions like editing cells or opening the sheet.