{"slug": "inbound-email-to-google-sheets-the-whole-path-including-the-two-gaps", "title": "Inbound email to Google Sheets: the whole path, including the two gaps", "summary": "MailKite's guide to routing inbound email into Google Sheets documents two failure points: Google Apps Script web apps answer every request with a 302 redirect to script.googleusercontent.com, which MailKite's webhook delivery treats as a failed delivery because it uses redirect: \"manual\", so the row is never written; and Google's official Workspace MCP extension can read a Sheet but cannot append to it. The guide recommends pushing the webhook to Zapier, Make, n8n or a Cloudflare Worker that returns 200 immediately, or pulling from a bound Apps Script calling MailKite's GET /api/messages on a one-minute trigger, while a free <name>.mailk.us subdomain handles receiving with no DNS setup.", "body_md": "# Inbound email to Google Sheets: the whole path, including the two gaps\n\nEvery 'email to Sheets' walkthrough stops at the webhook. The last mile is two separate products with a seam: Apps Script answers with a redirect, and Google's official Workspace MCP can read a Sheet but not append to it. Here is the path that actually closes, and which half does the writing.\n\nYou want every enquiry, support reply and form notification to land as a row in a spreadsheet. It sounds like one integration. It is three things that have to meet: an address that can receive mail, a receiver that can accept a POST, and a Sheet that accepts a row.\n\nThe first two are the easy part now. A MailKite subdomain gives you an address with no DNS work at all, and its inbound webhook hands you clean JSON. The last mile is where the walkthroughs get quiet, because the obvious answers both fail for a reason worth knowing.\n\n## The short answer\n\n- **Address:** claim a free MailKite subdomain —`<name>.mailk.us` — and there is no DNS step, no registrar, no propagation wait. Receiving starts in minutes.\n- **Receiver:** push the webhook at Zapier, Make or n8n (they answer`200` immediately), or run a small Apps Script inside the Sheet and pull. Do not point the webhook straight at an Apps Script web app.\n- **Agent:** connect Google’s official Workspace extension to*read* the Sheet back — count today’s rows, summarise them, flag the ones that need a reply. Writing stays with the receiver.\n\nThe rest of this post is why those two constraints exist, because a guide that skips them fails on camera the first time someone tries the obvious thing.\n\n## Gap one: a webhook cannot end at Apps Script\n\nThe natural design is: mail arrives, MailKite POSTs it to a Google Apps Script web app, the script appends a row. No server, no third party, free.\n\nIt does not work, and the failure is silent if you are not watching.\n\nDeploy an Apps Script as a web app and Google answers every request — `GET` and `POST` alike — with a `302` to `script.googleusercontent.com`, which is where the actual output lives. That is fine for a browser and for HTTP clients that follow redirects. MailKite’s webhook delivery uses `redirect: \"manual\"` on purpose: a `3xx` is recorded as a failed delivery, because a redirect is not proof that your endpoint processed the message. Following one blindly would also let a receiver that no longer exists look healthy right up until the mail is gone.\n\nSo the delivery is marked failed, retried on the backoff schedule, and never becomes a row. Nothing errors in your Sheet, because your script was never called.\n\nThat leaves two shapes that both work:\n\n**Push to something that answers 200.** Zapier’s Catch Hook, Make’s custom webhook, n8n’s Webhook node and a ten-line Cloudflare Worker all return `200` before they do the slow part. Then the automation appends the row. Latency is seconds, and it runs whether or not your laptop is open.\n\n```\nTrigger:  Webhooks by Zapier → Catch Hook\nAction:   Google Sheets → Create Spreadsheet Row\n          From    ← from__address\n          Subject ← subject\n          Body    ← textFromHtml\n```\n\n**Pull from inside the Sheet.** A bound Apps Script can call MailKite’s `GET /api/messages` on a one-minute trigger and append anything it has not seen. It is one file, no extra account, and the only cost is latency plus an API key in the script properties.\n\n``` js\nvar res = UrlFetchApp.fetch('https://api.mailkite.dev/api/messages?limit=50', {\n  headers: { Authorization: 'Bearer ' + key },\n  muteHttpExceptions: true,\n});\n// filter direction === 'inbound', dedupe on id, appendRow(...)\n```\n\nWhich one is better? Push if the row has to exist within seconds (lead capture, a demo on camera). Pull if you want zero third-party services and can live with a minute. The [full walkthrough](https://mailkite.dev/guides/inbound-email-to-google-sheets/) has both, with the complete script.\n\n## Gap two: Google’s MCP reads Sheets, it does not write them\n\nGoogle publishes an official Workspace extension for Gemini CLI — `gemini-cli-extensions/workspace` under the `google` org — and it ships a real MCP server. Point an agent at it and it can find your spreadsheet, read any range, and summarise what it sees.\n\nThat is genuinely useful here, just not for the writing half. The extension’s Sheets surface is three tools:\n\n| Tool | What it does | \n|---|---|\n| `sheets.getMetadata` | tabs, row and column counts, locale | \n| `sheets.getRange` | values from an A1 range | \n| `sheets.getText` | the whole sheet as text, CSV or JSON | \n\nAll reads. There is no `values.append`, so “ask the agent to add a row” is not a thing the official server can do today, however the prompt is worded.\n\nThe split that works is: **the automation writes, the agent reads.** The webhook or script owns the append; the agent owns the questions you actually have about the data — “how many enquiries came in today”, “which ones mention a deadline”, “draft replies to the three that asked about pricing”. That is also the safer division of labour: the write path is deterministic and testable, and the model never touches the Sheet’s contents.\n\nOne more thing worth saying plainly, because it comes up every time: an agent that can read your mail and your documents is a prompt-injection surface. Google’s own README says so. Keep the agent’s Sheet access scoped to the one spreadsheet, and do not let it take instructions from message bodies.\n\n## The part that got easy: the address\n\nThe old version of this tutorial started with a paragraph about MX records, then SPF, DKIM, DMARC and a propagation wait, and lost half the readers before the first email.\n\nMailKite hands out free subdomains on a zone we run. The agent claims one in a single call:\n\n```\nmailkite_claim_subdomain({ subdomain: \"leads-acme\" })\n// → { domain: \"leads-acme.mailk.us\", dns: [] }\n```\n\nThat empty `dns` array is the point — we publish the records. A subdomain of a domain you already own is still the right choice when the address has to look like you (`hello@yourbrand.com`), but for a contact form, a lead sheet or an agent inbox there is no reason to make DNS the first step.\n\nBecause it is a catch-all, every local part works: `hello@`, `forms@`, `fix-my-site@`. One webhook, one Sheet, no per-address setup.\n\n## What the row should contain\n\nThe inbound payload is the whole parsed message, so pick the fields before you build the map:\n\n- `from.address` — who to reply to\n- `subject`\n- `text` or`textFromHtml` — the sender’s plain text, or our derivation when they only sent HTML\n- `receivedAtIso`\n- `auth.spam` and`auth.spamSignals` — the edge’s verdict, informational but useful as a filter once the address is public\n- `attachments[]` — name, size and a signed download URL\n\nThe `id` is worth keeping as a column even if you never look at it: it is the dedupe key that makes a retry, a replay or a re-run of the script harmless.\n\n## When Sheets is the wrong answer\n\nSheets is a great CRM for one person and a bad database for a team. It caps at roughly ten million cells per file, has no transactions, and every editor can break a formula. If two people will be triaging the same inbox, or you need a query surface, put the rows in Airtable, a Postgres table or MailKite’s own contacts and sequences — the webhook payload is the same JSON either way.\n\nFor a freelancer with one enquiry form, a podcast inbox, or a “who wrote in this week” list, a Sheet is exactly right: it opens instantly on a phone, it is shareable, and it is the one tool everyone already has.\n\n## Build it in about ten minutes\n\nThe full path — the one-prompt agent setup, the subdomain claim, both receiver options with the complete Apps Script, and the read-back prompt for Google’s official extension — is in the guide:\n\n[Inbound email to Google Sheets →](https://mailkite.dev/guides/inbound-email-to-google-sheets/)\n\nNo DNS. No mail server. No serverless function to babysit. One address, one receiver, one Sheet — and an agent that can tell you what is in it.", "url": "https://wpnews.pro/news/inbound-email-to-google-sheets-the-whole-path-including-the-two-gaps", "canonical_source": "https://mailkite.dev/blog/inbound-email-to-google-sheets/", "published_at": "2026-11-28 00:00:00+00:00", "updated_at": "2026-11-28 14:15:17.988826+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools"], "entities": ["MailKite", "Google Sheets", "Google Apps Script", "Google Workspace", "Zapier", "Make", "n8n", "Cloudflare Workers"], "also_reported_by": [], "takeaway": "Don't point an inbound webhook at an Apps Script web app: Google answers with a 302 to script.googleusercontent.com and MailKite's redirect: \"manual\" delivery marks it failed, so push to a receiver that returns 200 first or poll GET /api/messages on a one-minute trigger.", "recommendation": {"advice": "Route inbound email webhooks to a receiver that returns 200 immediately, or poll the mail API from a bound Apps Script on a one-minute trigger, since Apps Script web apps redirect and break delivery.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/inbound-email-to-google-sheets-the-whole-path-including-the-two-gaps", "markdown": "https://wpnews.pro/news/inbound-email-to-google-sheets-the-whole-path-including-the-two-gaps.md", "text": "https://wpnews.pro/news/inbound-email-to-google-sheets-the-whole-path-including-the-two-gaps.txt", "jsonld": "https://wpnews.pro/news/inbound-email-to-google-sheets-the-whole-path-including-the-two-gaps.jsonld"}}