Gmail invoice attachment archiving to Drive and Sheets reconciliation
This AI-assisted n8n workflow monitors Gmail for invoice messages carrying file attachments. Qualifying PDFs upload to Google Drive, receive standard names and move into target archive folders. Extracted text passes through an OpenAI LLM chain and structured output parser before appending rows to your reconciliation Sheet.
- Catalogue ID
- #1764
- Functional nodes
- 14
- Connections
- 14
- Trigger
- gmailTrigger
- AI layer
- AI-assisted
Business problem solved
Supplier invoices scattered across busy Gmail threads force finance teams to rename files by hand, file them into monthly folders and copy totals into reconciliation sheets one invoice at a time.
Trigger
The Gmail trigger inspects incoming emails immediately as they arrive in your billing inbox.
Connected systems
- Gmail
- Google Drive
- OpenAI
- Structured output parser
- Google Sheets
- Self-hosted n8n
Every workflow is deployed on your own server with documentation, a run log and an error queue.
Workflow architecture
- 1. Gmail Trigger1 (Trigger) (connects to Setup1)
- 2. Setup1 (Service and data) (connects to Only invoice mails with…)
- 3. Upload PDF to Drive1 (Service and data) (connects to Rename file1)
- 4. Rename file1 (Service and data) (connects to Move to the correct folder1)
- 5. Move to the correct folder1 (Service and data) (connects to Gmail, Google Drive)
- 6. Gmail (Service and data)
- 7. Extract from File2 (Service and data) (connects to Apply Data Extraction Rules)
- 8. Google Drive (Service and data) (connects to Extract from File2)
- 9. OpenAI Model (AI layer) (connects to Apply Data Extraction Rules)
- 10. Structured Output Parser (AI layer) (connects to Apply Data Extraction Rules)
- 11. Append to Reconciliation… (Service and data)
- 12. Map Output (Service and data) (connects to Append to Reconciliation…)
- 13. Apply Data Extraction Rules (AI layer) (connects to Map Output)
- 14. Only invoice mails with… (Logic and routing) (connects to Upload PDF to Drive1, Gmail)
- Trigger
- AI layer
- Logic and routing
- Service and data
Node positions and directed links are generated from the verified catalogue record.
Workflow steps
- 01
Invoice attachment filter
Setup rules and a conditional check isolate invoice emails with attachments while routing non-invoice emails separately.
- 02
Drive upload, rename and filing
Attachments upload over HTTP to Drive, get renamed consistently and move into the target accounting folder.
- 03
Text extraction and structured AI parsing
Filed documents are read from Drive, extracted into text and parsed by OpenAI into strict invoice fields.
- 04
Output mapping and reconciliation sheet
Mapped invoice attributes append neatly into your Google Sheets reconciliation table for accounting review.
Error queue and human approval
Built-in state in the catalogue workflow
The verified catalogue workflow contains zero node-level error flags across its 14 functional nodes and 14 connections.
Production layer added by ALTAI
During live deployment, ALTAI adds duplicate invoice-number blocking, unreadable-PDF warning queues, Gmail status labels and accounting audit logs.
Gmail invoice attachments to Drive and Sheets Frequently asked questions
Yes. The conditional attachment filter checks message criteria before triggering Drive uploads.
Yes. The rename step uses custom naming expressions configured to match your finance folder structure.
The structured parser captures vendor, invoice number, issue date, tax and net total into mapped sheet columns.
Related n8n workflows
PDF and image to CSV extraction with Gemini
Routes PDFs and scanned images from Google Drive through dedicated extraction branches using Gemini, converts output to CSV and uploads back to Drive.
Google Keep note export extraction to Sheets
Scans Keep folder exports in ten-item batches, reads structured JSON note payloads, filters active entries and uses an OpenAI agent to update Google Sheets.
Multi-source spreadsheet transform to OneDrive and SFTP
Reads spreadsheets from local storage, HTTP, Google Drive or Microsoft OneDrive, transforms fields, rebuilds files and uploads to SFTP and cloud folders.

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