TriggerShelf

Error fix

Fix "You do not have permission to call MailApp.sendEmail"

Trigger: Installable on-editServices: MailApp, ScriptAppMock-tested: Nov 2026

Exception: You do not have permission to call MailApp.sendEmail

Google documents that a simple trigger cannot send an email, because the Gmail service needs authorization. Keep the logic, rename the function, and install the trigger yourself.

Set it up

  1. Rename your onEdit function to something else, for example notifyOnEdit.
  2. Run installEditTrigger once and approve the permission prompt.
  3. Edit a cell. Check Executions (left sidebar) for the run.

The script

/**
 * Fix: "You do not have permission to call MailApp.sendEmail".
 * Simple triggers cannot send mail. Rename your handler (not onEdit), then run
 * installEditTrigger once to create an installable trigger that can.
 */
function notifyOnEdit(e) {
  if (!e || !e.range) return 'skip:no-event';
  MailApp.sendEmail('you@example.com', 'Edited ' + e.range.getA1Notation(), 'New value: ' + e.value);
  return 'sent';
}

function installEditTrigger() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var exists = ScriptApp.getProjectTriggers().some(function (t) {
    return t.getHandlerFunction() === 'notifyOnEdit';
  });
  if (exists) return 'already-installed';
  ScriptApp.newTrigger('notifyOnEdit').forSpreadsheet(ss).onEdit().create();
  return 'installed';
}
Test status. 2 of 2 automated checks pass, run Nov 2026 against simulated Google services. This recipe has not yet been run inside a live Google account. Test it on a copy of your sheet first.

What you should see

FunctionEvent
notifyOnEditFrom spreadsheet, On edit

Triggers page after the fix. Sample values, not output from a real account.

Common errors and fixes

It still fails
The old simple onEdit function is still in the project. Remove or rename it.
Two emails per edit
Two triggers exist. Delete extras in the Triggers page.

Permissions. Running this script asks you to grant Google permissions for the services listed above, to your own script. TriggerShelf never receives your Google data. See the permissions table. Google will show "Google hasn't verified this app"; that is expected for a script you paste yourself.