# Zap blueprint: Order emails to a Google Sheet with Gemini

**This is a blueprint, not an import file.** Zapier has no public format for importing Zaps, so you rebuild these steps by hand in the Zap editor. It takes about 10–20 minutes (our estimate).
Create a new Zap: https://zapier.com/app/editor
Full recipe: https://recipeagents.usestarbase.com/recipes/order-emails-to-sheet-gemini

## Steps
1. **Trigger:** Gmail: New Email Matching Search
   - Recipe input: Order and receipt emails in Gmail
2. **Filter by Zapier** (optional): only continue if the input is the kind you want (see the recipe's failure modes).
3. **Action:** Google AI Studio (Gemini): Send Prompt, with a Gemini Flash-Lite or Flash model (Gemini 2.5 models are limited to earlier users)
   - Paste this prompt and map the trigger fields into the {{...}} placeholders:

```
Read this email. If it is not an order confirmation or a purchase receipt (for example a newsletter, an ad, or a shipping update), return {"is_order": false}. Otherwise return JSON: {"is_order": true, "shop", "order_number", "order_date" (YYYY-MM-DD), "currency" (3-letter code), "total" (number, exactly as printed), "items" (list of short names), "delivery_estimate", "return_by" (YYYY-MM-DD)}. Use null for anything the email doesn't state. Never calculate a total or a return date yourself. Return only the JSON. From: {{from}} Subject: {{subject}} Email: {{text}}
```
4. **Action:** Formatter by Zapier → Utilities → Import JSON / or Code by Zapier, to split the JSON fields (if the prompt returns JSON).
5. **Action:** Google Sheets: Create Spreadsheet Row
6. **Test each step** with a real example, then turn the Zap on. Keep a human approval on anything customer-facing.

## Recipe steps (from the page)
- Create an API key in Google AI Studio (aistudio.google.com/apikey). In n8n, add a Google Gemini(PaLM) API credential with that key; the host stays https://generativelanguage.googleapis.com.
- Make a Google Sheet with these headers in row 1: logged_at, order_date, shop, order_number, currency, total, items, delivery_estimate, return_by, from, subject, gmail_id, parse_error.
- Trigger: Gmail Trigger, polling every hour, search subject:(order OR receipt OR confirmation) -category:promotions, with Simplify turned off so the full email text comes through.
- Google Gemini node, version 1.1: Text → Message a Model, model ID models/gemini-3.5-flash-lite. Paste the prompt below, turn on Output Content as JSON, and under Options turn on Include Merged Response. Don't add Maximum Number of Tokens.
- Code node (in our file): parses the JSON, drops emails the model marked as not an order, and adds the sender, subject and Gmail ID so every row can be traced back to its email.
- Google Sheets → Append Row, mapping column data automatically, pointed at your sheet.
- Run it on a few old receipts first and compare each row with the email before you leave it running.

## Where it breaks
- Free tier means Google can use the emails: Google's pricing page says content sent on the free tier is used to improve Google's products, and paid-tier content isn't. Receipts carry your address and what you bought. If that matters to you, link billing to the project; at the volumes in the worked example the cost is well under a dollar a month.
- 429 RESOURCE_EXHAUSTED: Free-tier limits apply per Google Cloud project, not per API key, and your exact numbers are shown only in AI Studio. Daily request quotas reset at midnight Pacific time. If a backlog of old emails trips the limit, turn on Retry On Fail in the Gemini node's settings with a wait between tries, or let the backlog run over a few days.
- The node picks a preview model: Version 1.2 of n8n's Gemini node preselects a preview model (gemini-3-flash-preview in the n8n source we read on 2026-10-24), and Google's rate-limits page says limits are more restricted for preview models. Our file pins node version 1.1 and the stable models/gemini-3.5-flash-lite.
- Answers cut off after a few words: If you add Maximum Number of Tokens under the node's Options, n8n starts it at 16, which breaks the JSON. Remove the option or set it to 1,000 or more. The Code node logs anything it can't parse in the parse_error column instead of dropping it.
- Old tutorials use gemini-2.5-flash: Google's models page says the Gemini 2.5 models are limited to users who used them before, so a new key can't call them. Use Gemini 3.5 Flash-Lite, or 3.8 Flash if you need more reasoning: it has a free tier too, and on the paid tier costs $0.75/$3.75 per million tokens until Dec 31, 2026, then $1.50/$7.50.
- Shipping updates and duplicates: “Your order has shipped” emails match the search too. The prompt tells the model to skip them, but some will slip through, so sort the sheet by order_number now and then and delete repeats.
- Totals and return dates: The prompt asks for the total exactly as printed and never a calculated return date, so return_by is often empty: many shops only link to a returns policy. Check the first 20 rows against the emails before you rely on the sheet.

App and step names follow Zapier's current app directory as of 2026-10-24. Names change, so search the app in the editor if a step looks different.
