Google Sheets mail merge with auto status tracking

By General Input

Every 15 minutes, pull pending rows from your recipient sheet, send each contact a personalized email, and mark the row as Sent.

Integrations

  • Google Sheets
  • Send Email

Type

Deterministic Code

Categories

  • Marketing
  • Sales

I want a code workflow that runs every 15 minutes on a cron trigger and works through a Google Sheets mail merge for me.

My recipient sheet has columns like Email, FirstName, and Status, plus any custom merge fields I want to use (Company, City, OfferCode, etc.). The Status column tracks per-row state: blank or "Pending" means not yet sent, "Sent" means delivered, "Error" means something went wrong.

On each run:

1. Use Google Sheets Get Values to read the entire recipient sheet in one call, including the header row.

2. For every data row where the Status column is blank or equals "Pending":

a. Validate the Email column with a basic email-format regex. If it is invalid, use Google Sheets Update Values to set the Status cell for that row to "Error: invalid email" and skip the row.

b. Substitute the row values into a configured HTML body template and subject line template. Use {{ColumnName}} placeholders that resolve to the sheet's header columns (case-insensitive match on the header).

c. Call the Send Email service's Send an Email operation to deliver the rendered HTML message to the row's Email address.

d. On success, use Google Sheets Update Values to write "Sent <ISO timestamp>" into the Status column for that row.

e. On failure, use Google Sheets Update Values to write "Error: <short message>" into the Status column for that row.

3. Cap the run at 50 sends total. Remaining Pending rows are picked up on the next 15-minute tick.

Inputs I should be able to configure at the top of the workflow:

- Spreadsheet ID and sheet/tab name of the recipient sheet

- Subject line template (supports {{Column}} placeholders)

- HTML body template (supports {{Column}} placeholders)

- Per-run send cap (default 50)

- Which Status values count as ready to send (default: blank and "Pending")

Other requirements:

- Read the sheet once at the start of the run, do not re-fetch after each send.

- Update the Status cell one row at a time, immediately after each send, so a crash mid-run does not lose progress or double-send.

- Skip rows whose Email column is empty without marking them, so unfinished rows stay editable.

- Log a short summary at the end of each run: how many rows were sent, skipped, errored, and how many Pending rows remain.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads