Extract Turkish invoice data from Gmail PDFs with Google Gemini and Sheets
Ready for 3.0What this workflow does
This AI workflow has 21 nodes and runs on Gmail events. Along the way it connects Gmail, Google Drive, Google Sheets and Google Gemini Chat Model.
How it runs
Trigger: On Gmail events.
- Merge: merges the data from its input branches
- Set Email Fields (Edit Fields (Set)): sets 2 fields: attachments, message_id
- Loop Over Attachments (Loop Over Items (Split in Batches)): loops over the items in batches
- Split Attachments (Split Out): splits a list into separate items
- Upload to Google Drive (Google Drive): uses Google Drive
- Download from Google Drive (Google Drive): download
- Extract Invoice Data (Extract from File): extracts data from a file (pdf)
- AI Invoice Agent (AI Agent): runs an AI agent, with model: Google Gemini AI Chat; output parser: Parse Structured Details
- If: checks a condition and branches into true / false
- Read Invoice Data (Basic LLM Chain): sends a prompt to an LLM, with model: Google Gemini Chat Assistant; output parser: Parse Structured Output
…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.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (When Email Received).
Nodes used (13)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Split Out
n8n-nodes-base.splitOut - Merge
n8n-nodes-base.merge - Google Drive
n8n-nodes-base.googleDrive - Extract from File
n8n-nodes-base.extractFromFile - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - If
n8n-nodes-base.if - AI Agent
@n8n/n8n-nodes-langchain.agent - Google Sheets
n8n-nodes-base.googleSheets - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
From the author
Quick overview This workflow monitors Gmail for PDF attachments, uploads them to Google Drive, extracts invoice text from PDFs, uses Google Gemini to detect and parse Turkish invoice fields into structured data, and logs both invoice headers and line items…