n8nIntermediate10 min readUpdated May 25, 2026

n8n: Extract Every Invoice in Your Inbox with GPT-4o Vision

Attach an inbox to n8n, parse every PDF and image invoice with vision, and land structured line items in Google Sheets — no OCR service required.

n8nvisioninvoicesopenaiaccounting

Download this template

Grab a structured copy of "n8n: Extract Every Invoice in Your Inbox with GPT-4o Vision" as JSON (for programmatic import) or Markdown (for docs and README files). Both are licensed CC-BY-4.0 with attribution.

Overview

Bookkeepers still copy line items from PDFs by hand. Vision-capable LLMs eliminate that job — including for handwritten receipts. This workflow turns any inbox into a structured invoice ledger in Google Sheets, with confidence scores so humans review only the uncertain ones.

How it works

  1. IMAP trigger monitors an accounting@ inbox for messages with attachments.
  2. Attachments are filtered to PDF / PNG / JPG and passed to GPT-4o with a strict JSON schema.
  3. The model returns vendor, invoice number, date, currency, subtotal, tax, total, and line items.
  4. Confidence < 0.85 → routed to a 'Review' sheet; otherwise → appended to the main ledger.
  5. Original file is uploaded to Google Drive with a link stored in the row.

Benefits

  • Kills a 4-hour weekly bookkeeping task.
  • Structured line items — not just totals — mean better category analytics.
  • Confidence-based routing keeps humans in the loop only where it matters.

Use cases

  • SMBs with 20-200 invoices/month.
  • Consultancies handling client expense receipts.
  • Anyone whose bookkeeper still asks 'can you send me the PDF?'

Step-by-step guide

Step 1: Set up a dedicated inbox

accounting@yourdomain — vendors and forwarding rules go here. Never point this at a personal inbox.

Step 2: Filter attachments precisely

Reject anything > 10MB and anything not PDF/PNG/JPG. Multi-page PDFs need conversion to images before vision calls.

Step 3: Design the JSON schema first

Match your accounting software's field names exactly. Retro-fitting later means every historical row needs migration.

Step 4: Ask for confidence per field

Not just per invoice. If the total is high-confidence but the tax line is low, that's exactly the review signal you want.

Step 5: Route by confidence

≥0.85 → main sheet. <0.85 → review sheet. Weekly, sample review-sheet rows to tune the threshold.

Step 6: Archive originals

Upload every file to Drive under /invoices/YYYY/MM/. Store the link in the row for auditability.

Example

Row: 2026-05-14 | Acme Cloud | INV-8821 | USD 1,248.00 (subtotal 1,155.00, tax 93.00) | 4 line items | conf 0.94 | drive.google.com/…

FAQs

Related resources

Workflows, articles, and tools that pair with this build.