Skip to content

How to Fix Google Sheets onEdit Trigger Not Firing

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about How to Fix Google Sheets onEdit Trigger Not Firing. We cover key concepts, practical examples, and best practices.

The onEdit trigger in Google Sheets runs a script function every time a user edits a cell. When the trigger does not fire, the function name is wrong, the trigger was not installed, or the edit type (like a formula recalculation) is not supported by the trigger.

The Problem

You write an onEdit function but nothing happens when you edit a cell. The script exists in the Apps Script editor but the trigger never runs.

Wrong approach — adding console.log() statements without checking trigger setup.

The Fix

For a simple trigger, the function must be named exactly onEdit:

function onEdit(e) {
  var range = e.range;
  range.setNote("Edited at " + new Date());
}

Simple triggers run automatically with no setup required, but have limitations:

  • Cannot access services that require authorization (like GmailApp)
  • Run as the active user
  • Limited to 30 seconds execution

For an installable trigger, create it in the Apps Script editor:

1. Open Extensions → Apps Script
2. Triggers (clock icon) → Add Trigger
3. Choose function → On change → Head
4. Save → authorize permissions

Use an installable trigger when you need to access external services or run as a specific user.

Expected output:

Trigger function runs immediately after cell edit
Function receives the event object (e) with range, value, and source
Changes made by the function appear in the sheet

Prevention Tips

  • Name simple triggers exactly onEdit (case-sensitive) — they do not need manual installation
  • Use installable triggers when your script needs permissions beyond the current sheet
  • Check execution logs (Apps Script > Executions) to see if the trigger ran and what errors occurred
  • Avoid long-running operations in simple triggers — they have a 30-second limit
  • Use e.range to access the edited cell, not SpreadsheetApp.getActiveRange(), for reliable results

Common Mistakes with sheets onedit trigger

  1. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  2. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  3. Misunderstanding that String is [Char] with poor performance for large text operations

These mistakes appear frequently in real-world GOOGLE code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the difference between onEdit and onChange triggers?

onEdit fires only when a user edits a cell value. onChange fires for structural changes like inserting rows, adding columns, or pasting data. Use onEdit for value-based actions and onChange for structural automation.

Why does my onEdit trigger not fire when a formula recalculates?

Formula recalculation is not considered an edit. The onEdit trigger only fires when a user manually types or pastes a value. Use a time-based trigger (every minute) to check for formula-driven changes instead.

How do I pass additional information to my onEdit function?

The event object e contains: e.range (edited range), e.value (new value), e.oldValue (previous value), e.source (the spreadsheet), and e.user (email of the editing user). Use these properties instead of getActiveSheet() or getActiveRange().

Related: DodaTech's Trigger Health Dashboard monitors all active triggers, logs execution times, and alerts when triggers fail or exceed time limits. Use with DodaZIP for backup before trigger deployment.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro