Extract invoice data from Gmail PDF invoices with Gemini and Google Sheets
Ready for 3.0What this workflow does
This AI workflow has 10 nodes and runs on Gmail events. Along the way it connects Gmail, Google Gemini Chat Model and Google Sheets.
How it runs
Trigger: On Gmail events.
- Split PDF Attachments (Code): runs custom JavaScript code
- Extract PDF Text (Extract from File): extracts data from a file (pdf)
- Keep Email Context (Edit Fields (Set)): sets 3 fields: text, email_subject, email_from
- Extract Invoice Fields (Gemini) (Basic LLM Chain): sends a prompt to an LLM, with model: Gemini Chat Model; output parser: Invoice JSON Schema
- Normalize Invoice (Code): runs custom JavaScript code
- Log Invoice to Google Sheets (Google Sheets): append
- Mark Email as Read (Gmail): mark as read
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other Google Gemini + Google Sheets templates (819) · Other Google Gemini + Gmail templates (518)
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) (Watch Inbox for Invoice PDFs).
Nodes used (9)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - Extract from File
n8n-nodes-base.extractFromFile - Edit Fields (Set)
n8n-nodes-base.set - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Google Sheets
n8n-nodes-base.googleSheets - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow monitors a Gmail label for unread emails with PDF invoice attachments, extracts the PDF text, uses Google Gemini to parse key invoice fields into structured JSON, and appends the cleaned results to a Google Sheets tab before…