Extract invoice data from Gmail PDF invoices into a Google Sheets CRM with OpenRouter
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
What this workflow does
This AI workflow has 11 nodes and runs on Gmail events. Along the way it connects Gmail, OpenRouter Chat Model and Google Sheets.
How it runs
Trigger: On Gmail events.
- Split Attachments (Code): runs custom JavaScript code
- Has PDF Attachment? (If): checks a condition and branches into true / false
- Extract PDF Text (Extract from File): extracts data from a file (pdf)
- Flag for Manual Review (Google Sheets): append
- Text Extracted? (If): checks a condition and branches into true / false
- Extract Invoice Data (AI Agent): runs an AI agent, with model: OpenRouter Model; output parser: Invoice Fields Parser
- Add Metadata (Edit Fields (Set)): sets 3 fields: received_date, source_email, status
- Add to Invoice CRM (Google Sheets): append
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (New Invoice Email).
Nodes used (9)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Extract from File
n8n-nodes-base.extractFromFile - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets
From the author
Quick overview This workflow polls Gmail for new invoice emails, extracts text from PDF attachments, uses OpenRouter to parse key invoice fields, and appends the results to a Google Sheets “Invoice” tab, while sending non-PDFs or unreadable PDFs to a “Review”…