Docs/Integrations/n8n/Templates/Parse E-Invoices from Email to Sheets

Parse E-Invoices from Email to Sheets

Automatically extract structured invoice data from email attachments and log to Google Sheets. No OCR needed — 100% accurate parsing.

GmailInvoice-api.xhubGoogle Sheets5 min setup

How This Workflow Works

Parse E-Invoices from Email to Sheets — Workflow Diagram
  1. 1

    Searches Gmail for emails with PDF or XML attachments

  2. 2

    Extracts PDF/XML attachments from each email

  3. 3

    Auto-detects the invoice format (XRechnung or ZUGFeRD)

  4. 4

    Parses the e-invoice into structured JSON with 30+ fields

  5. 5

    Transforms the data into a flat row format

  6. 6

    Appends to Google Sheets for tracking, reporting, or accounting

Why This Matters

Unlike OCR-based solutions (90-95% accuracy), this workflow delivers 100% accurate data extraction from structured e-invoices — instantly, without LLM token costs, and with just one API key.

Google Sheets Structure

ColumnTypeExampleDescription
invoiceNumberTextRE-2025-001Invoice number
invoiceDateDate2025-01-15Invoice issue date
dueDateDate2025-02-15Payment due date
sellerNameTextLieferant GmbHSeller company name
sellerVatIdTextDE123456789Seller VAT ID
buyerNameTextKunde AGBuyer company name
buyerVatIdTextDE987654321Buyer VAT ID
subtotalNumber1500.00Net total amount
totalVatNumber285.00Total VAT amount
totalNumber1785.00Gross total amount
currencyTextEURCurrency code
sourceFormatTextxrechnungDetected e-invoice format
emailSubjectTextInvoice RE-2025-001Subject of the source email
processedAtDate2025-01-15T14:30:00ZProcessing timestamp

Setup Steps

  1. 1

    Install the n8n-nodes-invoice-api-xhub community node

  2. 2

    Create an API key at invoice-api.xhub.io

  3. 3

    Configure credentials: invoice-api.xhub, Gmail (OAuth2), Google Sheets (OAuth2)

  4. 4

    Create a Google Sheet with 'Invoices' tab and column headers

  5. 5

    Enter your spreadsheet ID in the 'Google Sheets: Append' node

  6. 6

    Click 'Execute Workflow' to process existing emails

Preview (truncated)

json
1{
2 "name": "Parse E-Invoices from Gmail to Google Sheets",
3 "nodes": [
4 {
5 "id": "manual-trigger-parse",
6 "name": "Manual Trigger",
7 "type": "n8n-nodes-base.manualTrigger",
8 "typeVersion": 1,
9 "position": [400, 600],
10 "parameters": {}
11 },
12 {
13 "id": "gmail-search-parse",
14 "name": "Gmail: Search Emails",
15 "type": "n8n-nodes-base.gmail",
16 "typeVersion": 2.2,
17 "position": [640, 600],
18 "parameters": {
19 "operation": "getAll",
20 "simple": false,
21 "filters": {
22 "q": "=has:attachment filename:pdf OR filename:xml"
23 },
24 "options": {
25 "dataPropertyAttachmentsPrefixName": "attachment_",
26 "downloadAttachments": true
27 }
28 },
29 "credentials": {
30 "gmailOAuth2": {
31 // ... (truncated)

Use Cases

Accounts Payable

Automatically log incoming XRechnung/ZUGFeRD invoices from suppliers

Bookkeeping

Extract invoice data for DATEV or other accounting software import

E-Invoice Mandate 2025

Process incoming e-invoices as required by the German mandate

Audit Trail

Searchable spreadsheet of all received e-invoices

Get Started Now

Import the workflow into your n8n instance and get started in minutes.