RecipeAgents / Recipes / Ops
Ops recipeGmail → Google Sheets: invoice PDFs with n8n
Invoices arrive as PDF attachments. This pulls out vendor, date, amount and VAT and adds a row to your bookkeeping sheet.
| Input | Email with PDF attachment |
| Tools | Gmail, Zapier (PDF to text) or Make, an AI step, Google Sheets |
| Time | Setup about 45 minutes. For 30 invoices a month it can save an hour or so of typing, though you still check each row. That's our estimate. |
n8n nodes in this workflow: Google Sheets. Each links to usage data and known problems in our n8n node library.
Download it
- n8n workflow (.json)Import in n8n: Workflows → Import from file. Then connect your credentials.
- Zapier blueprint (.md)Step-by-step rebuild guide. Zapier has no public import format, so this isn't one-click.
- Open the Zap editorCreate a new Zap and follow the blueprint.
The n8n file has three nodes (trigger, AI step, output) plus a read-me note. We check that its JSON structure is valid, but we haven't run every file in a live n8n instance, so test it with sample data before you switch it on. All 27 files, the logins each needs and how to fix common import errors are on our n8n templates page. Not sure which tool to run it on? See what this kind of recipe costs in n8n vs Zapier or n8n vs Make. On n8n Cloud the trigger's poll interval matters more than the node count: n8n pricing works through it.
Steps
- Trigger: new email matching has:attachment filename:pdf invoice.
- Extract text from the PDF.
- AI step returns JSON with the fields.
- Append a row. Look up the invoice number first to skip duplicates.
The prompt
Extract from this invoice text: vendor, invoice_number, date (YYYY-MM-DD), currency, net, vat, total. Return JSON; use null for missing fields; never compute values that aren't printed. Text: {{pdf_text}}Sample run
Invoice from 'UAB Spausdinimas', No. 2026-114, 2026-10-02, EUR, net 200.00, VAT 21% 42.00, total 242.00
{"vendor":"UAB Spausdinimas","invoice_number":"2026-114","date":"2026-10-02","currency":"EUR","net":200.00,"vat":42.00,"total":242.00}Where it breaks
- Scanned PDFs. Image-only PDFs come back with no text, so add an OCR step or flag them.
- Totals that don't add up. Add a sheet formula that checks net + vat = total and highlights mismatches.
- Anything customer-facing or money-related. Keep a human approval step until you've watched a few dozen runs and trust it.
Use Claude or Gemini instead
The prompt above isn't tied to ChatGPT. Our n8n file uses n8n's OpenAI node; to run the same recipe on Claude or Gemini, you swap that one step and point the next step at the new answer field. The trigger and output stay as they are. Here's the exact step to swap, checked 2026-10-24.
| Where you build | Claude (Anthropic) | Gemini (Google) |
|---|---|---|
| n8n | Replace the AI step node with Anthropic → Text → Message a Model, model e.g. claude-haiku-5-5 or claude-sonnet-5-5. Credential: Anthropic. | Replace it with Google Gemini → Text → Message a Model, model e.g. models/gemini-3.5-flash-lite. Credential: Google Gemini(PaLM) API. |
| n8n with the AI Agent node | Swap the chat model sub-node for Anthropic Chat Model. | Swap it for Google Gemini Chat Model. |
| Zapier | Anthropic (Claude) → Send Message | Google AI Studio (Gemini) → Send Prompt |
| Make | Anthropic Claude → Create a Prompt | Google Gemini AI → Generate a response, or Extract structured data when you want fields back |
What changes when you swap
- Where the answer lands. Our n8n file maps the OpenAI node's
message.contentinto the next step. In the Anthropic or Gemini node, turn on Include Merged Response under Options. The text then arrives as{{ $json.merged_response }}(Anthropic) or{{ $json.mergedResponse }}(Gemini). Our file appends the AI step's output to the sheet as is, so put a Code node in between that parses that text into columns. The Code node in our order emails recipe does this and accepts all three providers' output fields. - JSON. The Gemini node has an Output Content as JSON switch. The Anthropic node doesn't (node version 1, n8n source read 2026-10-24), even though Claude's API supports Claude structured outputs, so keep “Return JSON only, no code fences” in the prompt and parse the text. In Make, Gemini's Extract structured data module does the same job.
- Output length. n8n's Anthropic node sends a 1,024-token output cap unless you set Maximum Number of Tokens. On the Gemini node, that option starts at 16 when you add it, which cuts the answer off. Leave it out, or set it to a few thousand.
- You can skip the PDF-to-text step. Both n8n nodes have Document → Analyze Document, which takes the PDF itself. Per Anthropic's Claude PDF support docs, Claude reads each page as text and as an image, so an image-only scan can still work, within 32 MB and 600 pages per request. Check totals as before.
- Keys and free use. Claude: in the Claude Console, Settings → API Keys → + Create Key. It's pay as you go; new accounts get a small free credit, but there's no ongoing free tier. Gemini: create a key at aistudio.google.com/apikey (it sits in a Google Cloud project). Flash and Flash-Lite models have a free tier, but Google uses free-tier content to improve its products, so send customer, client or lead data only from a project with billing linked. Free limits are per project, not per key, and shown only in AI Studio. On n8n Cloud, both nodes can also run on n8n's Gateway credits. In Make, the Claude app's Simple Text Prompt runs on Make credits with no Anthropic account.
- Context and price. Current Claude models take a 1M-token context, and Gemini 3.5 Flash-Lite and 3.8 Flash take 1,048,576 input tokens, far more than this job needs. Per million input/output tokens: Claude Haiku 5.5 $0.10/$0.50 (prompts up to 100k tokens, $0.50/$2.50 above), Sonnet 5.5 $2/$10; Gemini 3.5 Flash-Lite $0.30/$2.50 on the paid tier, 3.8 Flash $0.75/$3.75 until Dec 31, 2026, then $1.50/$7.50. One trap in older tutorials: 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
gemini-2.5-flash.
Sources, read 2026-10-24: n8n Anthropic node, n8n Google Gemini node, Anthropic node source, Gemini node source, Anthropic credential, Google Gemini credential, Claude pricing, Claude models, Claude structured outputs, Gemini API pricing, Gemini rate limits, Gemini models, Zapier: Anthropic (Claude), Zapier: Google AI Studio (Gemini), Make: Anthropic Claude, Make: Google Gemini AI. Prices are per million tokens and change often, so re-check before you rely on them.
Tool names and pricing change often, so check each tool's current docs before you build. Times on this page are estimates, not measurements.
More ops recipes
- Alert when a supplier changes a price
- Monday digest of what's due this week
- Remind me 30 days before a contract renews
- Summarize a contract PDF with Claude
- Daily Slack channel digest with Claude
All collections · Full inbox-triage walkthrough
New to building agents? Plan this one first with the Invoice data extraction agent spec sheet on PlainAgent, our sister site with plain-English guides. Not sure which AI model to use? See the writing and chat assistant ranking on TaskRank.