Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets
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.
Worth a look
- Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Receiving Invoices)
Nodes used (14)
- Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - HTTP Request
n8n-nodes-base.httpRequest - Gmail Trigger
n8n-nodes-base.gmailTrigger - Google Sheets
n8n-nodes-base.googleSheets - Wait
n8n-nodes-base.wait - Switch
n8n-nodes-base.switch - Gmail
n8n-nodes-base.gmail - Edit Fields (Set)
n8n-nodes-base.set - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - If
n8n-nodes-base.if - Split Out
n8n-nodes-base.splitOut - Aggregate
n8n-nodes-base.aggregate - Merge
n8n-nodes-base.merge - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
What it does
This n8n template demonstrates how to automate invoice data extraction from PDF attachments received via Gmail. Using LlamaParse and Gemini LLM, this workflow parses structured fields like PO numbers, line items, tax amounts, and totals — and stores them neatly into a Google Sheet. Perfect for use cases such as: 💼 Finance teams managing vendor invoices 📊 Bookkeeping workflows 🔄 Automating monthly reconciliation Good to Know At the time of writing, LlamaParse and Gemini may involve API usage costs depending on your subscription tier. Check LlamaIndex Pricing and Gemini Pricing for updated info. LlamaParse provides Markdown-formatted parsed output which is then passed to an LLM for structured field extraction. Gemini models may be geo-restricted. If you encounter "model not found" errors, your region might not be supported. How it Works - Trigger: Watches your Gmail for new emails with PDF attachments. - Email Filter: Ensures we only parse fresh emails not already labeled as "invoice synced". - LlamaParse Upload: Uploads the PDF to LlamaParse’s parsing endpoint. - Status Polling: Periodically checks whether the parsing is complete. - Download Markdown: Once ready, it fetches the parsed invoice in Markdown format. - AI Parsing with Gemini: Sends the Markdown to Gemini LLM to extract structured JSON (like PO number, line items, taxes, etc.) using a predefined schema. - Google Sheets Upload: Stores extracted data into a predefined spreadsheet. - Labeling: Marks the email as “invoice synced” to avoid reprocessing. How to Use The trigger is based on Gmail, but you can replace this with a webhook or manual trigger for testing. Setup Instructions Gmail API - Enable Gmail API in Google Cloud Console. - Connect your Gmail account in n8n credentials. - Allow read + modify access. Google Sheets - Create a new Google Sheet with the following headers (row 1): Date | Vendor Name | Invoice Number | PO Number | Line Items | Subtotal | Tax | Total Amount - Connect Google Sheets in n8n and paste the Sheet ID in the node. - You can customise the google sheet basis your requirement. LlamaParse - Get a LlamaIndex API Key from LlamaIndex. - Use the LlamaParse upload and polling nodes to process your PDFs. Gemini (via Vertex AI) - Set up Gemini access in GCP. - Use the Gemini 2.5 Model. - Construct a structured prompt to extract required fields. Labeling - Create a Gmail label named "Invoice Synced" for tracking processed emails. Requirements Gmail account with API access LlamaParse (LlamaIndex) account with API Key Google Sheets API credentials Access to Gemini 2.5 model via Google Vertex AI Customising This Workflow This template is just the beginning. You can expand it to: - Auto-generate invoices back to vendors - Run duplicate checks before inserting into Sheets - Integrate with accounting tools like Zoho, QuickBooks, or Tally - Trigger Slack/Email notifications on specific vendors or high invoice amounts