Extract & organize email invoices with Gmail, Drive & OpenAI GPT
Ready for 3.0What this workflow does
This AI workflow has 20 nodes and runs on Gmail events. Along the way it connects OpenAI Chat Model, Gmail, Google Drive and Google Sheets.
How it runs
Trigger: On Gmail events.
- Get a message (Gmail): get
- Code: runs custom JavaScript code
- Extract from File: extracts data from a file (pdf)
- Merge: merges the data from its input branches
- Invoice Recognition Agent (AI Agent): runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Output Parser
- Upload file (Google Drive): uses Google Drive
- Check wether it is an invoice (If): checks a condition and branches into true / false
- Update Invoice parameters (Google Sheets): append or update
- Invoice Data extractor (AI Agent): runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Output Parser
- Mark a message as read (Gmail): mark as read
…plus 3 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.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Gmail Trigger).
Nodes used (12)
- OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - No Operation, do nothing
n8n-nodes-base.noOp - Gmail Trigger
n8n-nodes-base.gmailTrigger - Google Drive
n8n-nodes-base.googleDrive - AI Agent
@n8n/n8n-nodes-langchain.agent - Extract from File
n8n-nodes-base.extractFromFile - If
n8n-nodes-base.if - Google Sheets
n8n-nodes-base.googleSheets - Gmail
n8n-nodes-base.gmail - Code
n8n-nodes-base.code - Merge
n8n-nodes-base.merge
From the author
Who’s it for This template is for founders, finance teams, and solo operators who receive lots of invoices by email and want them captured automatically in a single, searchable source of truth. If you’re tired of hunting through your inbox for invoice PDFs or…