Gmail ZIP, PDF and XML invoice extraction to Google Sheets
This n8n workflow captures supplier invoice emails from Gmail, unpacks ZIP archives and separates PDF and XML attachments automatically. An AI extraction agent and calculator tool parse line items, tax figures and totals into a strict schema. Source documents are archived in Google Drive while structured rows land in Google Sheets.
- Catalogue ID
- #1765
- Functional nodes
- 22
- Connections
- 24
- Trigger
- gmailTrigger
- AI layer
- AI-assisted
Business problem solved
Finance teams spend hours opening mixed ZIP, PDF and XML attachments from suppliers and typing line items into spreadsheets by hand. One mistyped figure during month-end close stalls reconciliation across accounts.
Trigger
The Gmail trigger starts the workflow whenever a new email with invoice attachments arrives in the monitored label.
Connected systems
- Gmail
- Google Drive
- Google Sheets
- OpenAI
- Calculator and schema parser
- Self-hosted n8n
Every workflow is deployed on your own server with documentation, a run log and an error queue.
Workflow steps
- 01
Attachment fetch and ZIP unpacking
Email attachments are downloaded, ZIP archives are unpacked and PDF or XML invoice files are filtered for processing.
- 02
Text extraction and schema parsing
The file extraction node reads document content while the structured parser maps vendor, dates, tax and line items cleanly.
- 03
Arithmetic cross-check
A calculator tool checks subtotals, tax amounts and invoice totals so extraction discrepancies surface before posting.
- 04
Drive archive and sheet entry
The original file is stored in Google Drive and structured invoice rows are appended to Google Sheets with the archive link.
Error queue and human approval
Built-in state in the catalogue workflow
The verified catalogue workflow contains zero node-level error flags across its 22 functional nodes and 24 connections.
Production layer added by ALTAI
During live deployment, ALTAI adds an accounting review queue whenever totals disagree, duplicate invoice-number protection, unreadable attachment alerts and an audit log.
Email PDF and XML invoice extraction workflow Frequently asked questions
Production deployments check vendor and invoice number pairs in the run log so repeated emails route to a warning queue instead of duplicating entries.
The calculation check flags the mismatch immediately and routes the invoice to an accounting approval queue rather than posting unverified numbers.
Yes. The structured JSON output can connect directly to Exact, Xero, Twinfield or your internal ERP during deployment.
File-type and content filters keep only supported invoice documents and skip unrelated files safely.
Related n8n workflows
Email receipt and expense extraction workflow
Uses two Gmail triggers for receipts and payment alerts, splits multi-item expenses and writes structured rows into Google Sheets with built-in error flags.
Google Drive PDF and image to CSV workflow
Watches a Google Drive folder for PDFs and scanned images, routes by file type, extracts fields with Gemini and exports clean CSV files.
Shopify to ERP sales orders and invoices
Splits paid Shopify orders by warehouse location and creates ERP customers, sales orders and invoices with 10 built-in error and rollback nodes.

We write the proposal after we have found the problem together
In a thirty-minute call we listen to how you work and talk through where time and customers are slipping away. If you do not need a digital fix, we will tell you that too.
30 minutes · no preparation needed
The call and the week of discovery are both free.Read the terms