Extract and validate Gmail invoice PDFs into Google Sheets with OpenAI
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 9 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI Chat Model and Google Sheets.
How it runs
Trigger: On Gmail events.
- Only PDF Attachments (Filter): keeps only the items that match a condition
- PDF To Text (Extract from File): extracts data from a file (pdf)
- Read The Invoice (Information Extractor): extracts structured fields from text with AI, with model: Extraction Model
- Validate Before Booking (Code): runs custom JavaScript code
- Did It Reconcile? (If): checks a condition and branches into true / false
- Append To Books (Google Sheets): append
- Send To Exceptions Queue (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 (8)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Filter
n8n-nodes-base.filter - Extract from File
n8n-nodes-base.extractFromFile - Information Extractor
@n8n/n8n-nodes-langchain.informationExtractor - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Google Sheets
n8n-nodes-base.googleSheets
From the author
Quick overview This workflow watches a Gmail label for invoice emails with PDF attachments, extracts the PDF text, uses OpenAI to pull structured invoice fields, validates totals and VAT logic, and then appends clean invoices to an Invoices tab in Google…