Throttle GmailApp sends so you don't burn the daily quota
The reminder job ran fine for months. Then the list grew past a hundred rows, and one morning the Executions log says “Service invoked too…
Throttle GmailApp sends so you don't burn the daily quota
The reminder job ran fine for months. Then the list grew past a hundred rows, and one morning the Executions log says “Service invoked too…
Pull Gmail messages into a sheet without duplicate threads
Every vendor receipt lands in Gmail. Every Monday someone copies them into the Receipts tab by hand. You script it, put it on a trigger, and…
Send As Alias
sendAsAlias(to, subject, body, opts) sends mail from a Gmail alias after checking GmailApp.getAliases(). If {from} is not on that list, it…
Test Recipient Or
testRecipientOr(realEmail) is a small switch for outgoing mail. When the script property TEST_MODE is on, it returns your address instead of…
Apply Gmail Label Rules
applyGmailLabelRules(rules) takes rule objects {query, label, archive}, creates any label that does not exist, applies it to matching…
Get Latest Csv Attachment
A vendor or report tool emails you a CSV every morning. getLatestCsvAttachment(query) searches Gmail, picks the newest .csv attachment from…
Create Drafts From Rows
A sheet of recipients and a template, and a human who still wants to read every email before it goes out. createDraftsFromRows(rows, buildFn…
Send Digest Per Owner
One big “open items” email to the whole team gets ignored. One short email per person, listing only their rows, gets read…
Send Email With Budget
A nightly job that emails 300 people works fine until the day it doesn't, and then it dies halfway through with “Service invoked too many…
Get Unprocessed Threads
Your nightly job pulls vendor receipts out of Gmail into a sheet. Run it twice and you get every receipt twice. getUnprocessedThreads(query…
Email yourself when the nightly job fails
You've got a time-driven sync that "mostly works" until it doesn't — and you find out three days later from a confused teammate. Triggers…
Email Yourself an Error Alert
Nightly jobs that "mostly work" fail quietly until a teammate notices bad data. emailErrorAlert sends you a plain Gmail with the error…
Send an HTML Email with GmailApp
GmailApp.sendEmail can send HTML — you just need htmlBody (and a plain-text fallback for picky clients). This helper wraps the options bag…