Match supplier invoices to purchase orders with Gmail, OpenAI, and Data Tables
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 19 nodes and runs on Gmail events. Along the way it connects Gmail and OpenAI Chat Model.
How it runs
Trigger: On Gmail events.
- Settings (Edit Fields (Set)): sets 3 fields: tolerance_percent, tolerance_amount, supplier_label
- Keep Only The PDFs (Code): runs custom JavaScript code
- Is There An Invoice Attached? (If): checks a condition and branches into true / false
- Read The PDF (Extract from File): extracts data from a file (pdf)
- Pull Out The Invoice Fields (Information Extractor): extracts structured fields from text with AI, with model: Model
- Parse The Money (Code): runs custom JavaScript code
- Read The Open Purchase Orders (Data table): get
- Everything In Hand (Merge): merges the data from its input branches
- Read The Invoices You Have Seen (Data table): get
- Match It Against A Purchase Order (Code): runs custom JavaScript code
…plus 6 more steps. See the full node list below.
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.
Nodes used (13)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Extract from File
n8n-nodes-base.extractFromFile - Information Extractor
@n8n/n8n-nodes-langchain.informationExtractor - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Data table
n8n-nodes-base.dataTable - Merge
n8n-nodes-base.merge - Switch
n8n-nodes-base.switch - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Gmail
n8n-nodes-base.gmail - No Operation, do nothing
n8n-nodes-base.noOp
From the author
Quick overview This workflow monitors a Gmail label for unread supplier invoice emails, extracts key fields from PDF attachments with OpenAI, matches invoices against n8n Data Tables of open purchase orders and previously seen invoices, then logs cleared…