Log labeled Gmail emails to Google Sheets
Every new email under a Gmail label or mailbox you choose gets its own row in a Google Sheet, with the date, sender, subject, a short preview and a link back to the message, so you keep a running record of your email in one place.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/log-labeled-gmail-emails-to-google-sheets/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Personal Productivity · Email management
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/log-labeled-gmail-emails-to-google-sheets
Set it up with the CLI
- Add it. Copies the folder into
zaps/log-labeled-gmail-emails-to-google-sheets/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/log-labeled-gmail-emails-to-google-sheets - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy log-labeled-gmail-emails-to-google-sheets - Check it. Its recent runs, with status and errors.
npx zap-pack logs log-labeled-gmail-emails-to-google-sheets
zaps/log-labeled-gmail-emails-to-google-sheets/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 2 to fill in
- connections/gmail.tsThe
gmailaccount it uses - connections/google-sheets.tsThe
google-sheetsaccount it uses - triggers/message.tsWhat starts it:
gmailmessage1 to fill in - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a new email arrives under the monitored Gmail label or mailbox (
gmail,message). - The workflow tidies the email: it strips quotes from the sender's display name and cuts the body to a one-line preview of at most
PREVIEW_LENGTHcharacters. - Google Sheets adds one row to the log worksheet: received date, sender name, sender email, subject, preview, message ID and a link that opens the message in Gmail. Every email gets a new row.
The Zap only writes to the sheet. It does not change, label or move anything in Gmail.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | Where | What goes there |
|---|---|---|
REPLACE_GMAIL_LABEL |
label_ids in triggers/message.ts |
The Gmail label or mailbox to log. Ask which one, then look up its ID with the user's Gmail connection. |
REPLACE_SPREADSHEET_ID |
config.ts |
The spreadsheet that holds the log. Ask which sheet it is, then look up its ID with the user's Google Sheets connection. |
REPLACE_WORKSHEET_ID |
config.ts |
The tab of that sheet that holds the log. Look up its ID with the user's Google Sheets connection. |
Also review the defaults with them:
COLUMNSinworkflow.ts: column keys such asCOL$A, not header names. The sheet needs a header row in this order: Received At, Sender Name, Sender Email, Subject, Preview, Message ID, Message Link. If the user has no log yet, offer to create a sheet with those headers; if their columns differ, map each field to the right column key.PREVIEW_LENGTH:200characters of the body.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/log-labeled-gmail-emails-to-google-sheets, replace each REPLACE_… value as this file says, then run npx zap-pack deploy log-labeled-gmail-emails-to-google-sheets, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. Either way, name the workflow Log labeled Gmail emails to Google Sheets (zapier.sh/log-labeled-gmail-emails-to-google-sheets): zap-pack takes that name from this file's title, so leave the title as it is, and with Zapier MCP give the workflow that name when you create it. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
gmail(the trigger's account, the mailbox whose emails are logged) andgoogle-sheets(the account that owns the log) to the user's connections. No other app needs a connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/message.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. Set the trigger'slabel_idsparam to the monitored label or mailbox. Get the choices withget_trigger_field_choicesonlabel_ids; system mailboxes use their names (INBOX), and user labels look likeLabel_123…. Never leave it empty: an empty value fires on all mail, drafts included. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connections and sample the Gmail trigger before the first test run, and fix any key in
workflow.tsthat doesn't match.
Test it
Run this sample as a draft test run (run_workflow_draft in Zapier MCP) before publishing, pointed at a copy of the log sheet. It is made-up data, not a real email:
{
"id": "1a189f4f3104ae58",
"message_id": "1a189f4f3104ae58",
"from": {
"name": "\"[install-test] Test Sender\"",
"email": "test-sender@example.com"
},
"subject": "[install-test] Weekly project update",
"body_plain": "Hi team,\n\nHere is this week's update. The draft is ready for review and the launch date is unchanged.\n\nThanks,\nTest Sender",
"date": "Thu, 29 Oct 2026 16:18:13 -0700",
"message_url": "https://mail.google.com/mail/u/0/#inbox/install-test-1"
}
Confirm one new row appears with the date, Test Sender without quotes, test-sender@example.com, the subject, a single-line preview, the message ID and the Gmail link in the mapped columns. If run-status tools aren't available, check the result in Google Sheets directly. Ask the user to delete the test row; the agent doesn't delete it.
Then publish, wait until the trigger is active, and confirm it in the editor.
Notes
- The trigger watches one label or mailbox. If
label_idsis left empty it fires on all mail, drafts included, so always set it. - Rows are never deduplicated. If Gmail delivers the same message twice, for example when a label is removed and added again, it can be logged twice.
- The preview is the plain-text body with line breaks collapsed, cut to
PREVIEW_LENGTHcharacters. An HTML-only email gets an empty preview. - The message link is the one Gmail's trigger provides. It opens the email in the connected account, so only people with access to that inbox can follow it.
- Google Sheets may show the date in the sheet's own format and time zone.
- The sheet holds senders' names and email addresses and message previews. Share it only with the people who need it, and don't commit a real spreadsheet ID to a repository.