Recipe
Send an email when a checkbox is ticked in Google Sheets
Tick the box in column H and the row's columns A to E are emailed to the address in column F. Column I gets a timestamp, so the same row never sends twice.
Set it up
- Open the sheet, then Extensions > Apps Script. Paste the script and save.
- Change CFG at the top if your columns differ from the layout above the code.
- Click Triggers (clock icon) > Add trigger. Choose onCheckboxEdit, From spreadsheet, On edit. Approve the permission prompt.
The script
/**
* Email a row when its checkbox is ticked.
* Layout: A-E data, F recipient email, H checkbox, I "Sent at" stamp. Row 1 = headers.
* Trigger: installable On edit trigger for onCheckboxEdit.
*/
var CFG = { sheetName: 'Sheet1', checkboxCol: 8, emailCol: 6, sentCol: 9, firstDataCol: 1, lastDataCol: 5 };
function onCheckboxEdit(e) {
if (!e || !e.range) return 'skip:no-event';
var range = e.range;
var sheet = range.getSheet();
if (sheet.getName() !== CFG.sheetName) return 'skip:sheet';
if (range.getColumn() !== CFG.checkboxCol || range.getRow() < 2) return 'skip:cell';
if (e.value !== 'TRUE') return 'skip:unchecked';
var row = range.getRow();
if (sheet.getRange(row, CFG.sentCol).getValue()) return 'skip:already-sent';
var width = CFG.lastDataCol - CFG.firstDataCol + 1;
var headers = sheet.getRange(1, CFG.firstDataCol, 1, width).getValues()[0];
var values = sheet.getRange(row, CFG.firstDataCol, 1, width).getValues()[0];
var to = String(sheet.getRange(row, CFG.emailCol).getValue()).trim();
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(to)) return 'skip:bad-email';
var body = headers.map(function (h, i) { return h + ': ' + values[i]; }).join('\n');
MailApp.sendEmail(to, 'Row ' + row + ' update', body);
sheet.getRange(row, CFG.sentCol).setValue(new Date());
return 'sent';
}What you should see
| Name | Task | Due | Send? | Sent at | |
|---|---|---|---|---|---|
| Ana | Invoice | Nov 20 | ana@example.com | TRUE | 2026-11-14 10:02 |
| Ben | Report | Nov 21 | ben@example.com | FALSE |
After ticking H2: the row is emailed and I2 is stamped. Sample values, not output from a real account.
Common errors and fixes
- Exception: You do not have permission to call MailApp.sendEmail
- A simple onEdit trigger cannot send mail. Use the installable trigger from step 3, and do not name the function onEdit.
- The email sends twice
- Column I must stay filled after a send. Clearing it re-arms the row.
- Nothing happens when I tick the box
- The trigger is missing, or sheetName in CFG does not match the tab name.
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.
TriggerShelf is independent and not affiliated with or endorsed by Google LLC. Google Sheets, Gmail, Google Drive and Apps Script are trademarks of Google LLC. Quota figures come from Google's Apps Script quotas page. Test on a copy first.