Archive E-Invoices from Email
Automatically receive, parse, and archive incoming e-invoices to Google Drive. Files are renamed with invoice number, date, and supplier name.
How This Workflow Works

- 1
Watches Gmail for new emails with PDF or XML attachments
- 2
Extracts attachments and filters for invoice files
- 3
Auto-detects the e-invoice format (XRechnung, ZUGFeRD, Factur-X, etc.)
- 4
Parses the invoice to extract metadata (invoice number, date, seller)
- 5
Renames the file: 2025-01-15_SupplierName_INV-001.xml
- 6
Uploads to Google Drive, organized by month
Why This Matters
Manual invoice filing is error-prone and time-consuming. Files arrive as attachment.pdf or rechnung_2025.xml — with no consistent naming. This workflow automatically creates a clean, searchable archive.
Google Sheets Structure
| Column | Type | Example | Description |
|---|---|---|---|
newFilename | Text | 2025-01-15_Telekom_RE-2025-001.xml | Renamed filename as uploaded to Drive |
monthFolder | Text | 2025-01 | Year-month for folder organization |
invoiceNumber | Text | RE-2025-001 | Extracted invoice number |
invoiceDate | Date | 2025-01-15 | Invoice issue date |
sellerName | Text | Deutsche Telekom AG | Seller/supplier company name |
buyerName | Text | Meine Firma GmbH | Buyer/customer company name |
total | Number | 1785.00 | Invoice total amount |
currency | Text | EUR | Currency code |
format | Text | xrechnung | Detected e-invoice format |
Setup Steps
- 1
Install the n8n-nodes-invoice-api-xhub community node
- 2
Create an API key at invoice-api.xhub.io
- 3
Configure credentials: invoice-api.xhub, Gmail (OAuth2), Google Drive (OAuth2), Google Sheets (OAuth2)
- 4
Set your Google Drive folder ID in the 'Google Drive: Upload' node
- 5
Set your Google Sheets spreadsheet ID in the 'Google Sheets: Log Invoice' node
- 6
Activate the workflow — it runs automatically on new emails
Preview (truncated)
1{2 "name": "Archive E-Invoices from Email to Google Drive",3 "nodes": [4 {5 "id": "trigger-email-archive",6 "name": "Gmail Trigger",7 "type": "n8n-nodes-base.gmailTrigger",8 "typeVersion": 1.3,9 "position": [400, 600],10 "parameters": {11 "simple": false,12 "pollTimes": {13 "item": [{ "mode": "everyMinute" }]14 },15 "filters": {16 "q": "has:attachment filename:pdf OR filename:xml"17 },18 "options": {19 "dataPropertyAttachmentsPrefixName": "attachment_",20 "downloadAttachments": true21 }22 },23 "credentials": {24 "gmailOAuth2": {25 "id": "",26 "name": "Gmail account"27 }28 }29 },30 {31 // ... (truncated)Use Cases
E-Invoice Mandate 2025
Archive incoming e-invoices as required by the German B2B mandate
Accounts Payable
Organize supplier invoices automatically
Tax Preparation
Monthly folders make year-end accounting easy
Audit Compliance
Searchable archive with consistent naming