Skip to main content
Lifetime license included with every purchase
n8n workflowsreceipt ocrexpense automationfinance automation

n8n Receipt OCR Automation: Email a Receipt, Get a P&L Row

Build an n8n receipt OCR automation that reads emailed receipts with GPT-4o-mini Vision, routes by confidence, and logs vendor, amount, and tax to a P&L sheet.

Nn8n Marketplace Team·October 14, 2026·Updated October 14, 2026·7 min read

A box of receipts. A shoebox, a phone camera roll, a folder of forwarded PDFs nobody's opened. Month-end arrives and someone keys them into a spreadsheet by hand, mistyping a total or skipping the tax line. The P&L is late and slightly wrong, every single month.

n8n receipt OCR automation ends the manual keying. You forward a receipt or invoice to an inbox, GPT-4o-mini Vision reads it, and the vendor, date, amount, tax, and category land as a row in your Google Sheets P&L. No third-party parsing SaaS, no shoebox, and a confidence gate that keeps the bad reads out of your books.

The guides ranking here lean on extra services and skip the gate. The Azure OCR receipt guide chains Azure Computer Vision plus a chat model and never mentions confidence scoring, email ingestion, or P&L reporting. The popular Telegram expense template is photo-via-Telegram with a Mistral agent, no Gmail polling, and no confidence routing to an Errors tab. Email-in, vision-direct, confidence-gated is the unwritten version.

What receipt OCR automation can do

Receipt entry is a clerical loop that a workflow erases:

  • Watch an inbox for emails carrying a receipt or invoice attachment.
  • Read the image directly with a vision model, no separate OCR step.
  • Extract vendor, date, amount, tax, currency, and category as JSON.
  • Score each extraction's confidence and route on it.
  • Append high-confidence rows to the P&L, low-confidence to an Errors tab.
  • Send a monthly category-breakdown digest of where the money went.
  • Run entirely on your n8n instance plus an OpenAI account.

That's bookkeeping that updates itself between month-ends.

Why the confidence gate is non-negotiable

Here's the take worth defending: a receipt OCR flow without a confidence check is worse than no automation, because it logs wrong numbers with the same confidence as right ones. A human keying receipts at least squints at a blurry total. A naive workflow appends whatever the model guessed and you discover the error during a tax filing.

The fix is one extra field and one extra branch. Ask the model to return a confidence score with the data. An n8n-nodes-base.if v2 node reads it. High-confidence receipts flow to the main P&L tab; anything uncertain or unreadable routes to a separate Errors tab where a person spends ten seconds confirming or fixing it. The fast path stays fully automatic for the clean 90 percent, and the murky 10 percent gets a glance instead of silently corrupting the ledger.

Dropping the separate OCR service is the other quiet win. The two-step Azure-then-model pattern was necessary when vision models couldn't read images. GPT-4o-mini Vision reads the receipt and returns fields in one call, so the workflow loses a service, a credential, and a failure point.

The receipt OCR pipeline

Gmail poll (every 5 min, attachment present)
        │
   Extract first attachment (image/PDF)
        │
   GPT-4o-mini Vision → vendor, date, amount, tax, currency, category, confidence
        │
   Parse JSON (Code node)
        │
   IF confidence high? ── yes ──► append to P&L tab
        │ no
   Append to Errors tab (manual review)

One pass, with a gate that protects the books.

Step-by-step breakdown

1. Poll Gmail for attachments

A Gmail trigger checks every 5 minutes for new emails carrying an attachment. Poll on an interval, not every minute; tight polling burns OAuth quota for no benefit since receipts arrive in clusters, not by the second. Forwarding a receipt to one inbox is the lowest-friction capture there is.

2. Pull the attachment

A n8n-nodes-base.code v2 node grabs the first attachment, whether it's a photo, a screenshot, or a PDF, and prepares it for the model. One attachment per email keeps the mapping simple; multi-attachment emails are an edge case you can add later.

3. Read the receipt with Vision

The @n8n/n8n-nodes-langchain.openAi v2.1 node sends the image to GPT-4o-mini Vision with a structured prompt asking for vendor, date, amount, tax, currency, category, and a confidence score. Its response lands at $json.output[0].content[0].text. The model needs the modelId.__rl wrapper (value gpt-4o-mini, mode list) to resolve correctly; copying an older n8n-nodes-base.openAi config from a 2023 tutorial breaks the output path silently.

4. Parse the JSON

The model returns text, and the next node expects an object, so a n8n-nodes-base.code v2 node parses the JSON every time. Add this step even when it feels redundant. A missing parse is the most common reason these workflows fail, and the execution log makes the broken parse obvious while the failure itself doesn't announce.

5. Route by confidence and log

An n8n-nodes-base.if v2 node compares the confidence score against your floor. High-confidence extractions append a timestamped row to the main P&L tab via n8n-nodes-base.googleSheets v4.5; low-confidence ones land in an Errors tab. A separate monthly digest reads the ledger on the 1st and emails per-category totals, so trends surface without anyone building a report.

Implementation patterns

Pattern 1 — Vision-direct extraction. Skip the separate OCR service entirely. One vision call returns structured fields, which removes a credential and a whole class of layout-change failures.

Attachment → GPT-4o-mini Vision (image + structured prompt) → JSON fields

Pattern 2 — Confidence routing. The model's own confidence score drives the split between trusted and review.

Parse JSON → IF (confidence ≥ floor) → P&L tab | Errors tab

Pattern 3 — The month-end digest. A second n8n-nodes-base.scheduleTrigger v1.2 fires on the 1st, reads the ledger, totals by category, and emails a plain-text summary. The reporting comes free off the data the intake already captured.

n8n nodes you'll use most

NodePurpose
Gmail triggerPoll for emails with receipt/invoice attachments
n8n-nodes-base.code v2Pull the attachment and parse the model's JSON
@n8n/n8n-nodes-langchain.openAi v2.1Read the receipt with GPT-4o-mini Vision
n8n-nodes-base.if v2Route by confidence to P&L or Errors
n8n-nodes-base.googleSheets v4.5Append rows and read the ledger for the digest
n8n-nodes-base.scheduleTrigger v1.2Fire the monthly category digest

Getting started

  1. Set up a Google Sheet with a P&L tab and a separate Errors tab.
  2. Add the Gmail trigger and point it at the inbox you'll forward receipts to.
  3. Pull the first attachment in a Code node.
  4. Send it to GPT-4o-mini Vision with a structured field-and-confidence prompt.
  5. Parse the JSON, then route on confidence with an IF node.
  6. Append to the right tab, and add a monthly digest on a Schedule trigger.
  7. Or import a tested flow and start forwarding receipts now.
Start from a working flow

The Vision prompt, the confidence floor, and the two-tab routing take real tuning to get right. The ReceiptLedger: Receipts & Invoices to Google Sheets P&L template ships it: Gmail polling, GPT-4o-mini Vision extraction, confidence-based routing to a P&L tab and an Errors tab, and a monthly category digest, with no third-party parsing SaaS.

Browse the finance templates →

Where this fits

Receipt capture is the front door of a finance stack. Once expenses land in a structured ledger, the same data feeds reporting and reconciliation, which is why teams pair this with broader expense tracking automation. The confidence-routing pattern here is the same trustworthiness gate that shows up in data validation workflows anywhere a model's output enters a system of record.

Skip the build

The ReceiptLedger template ships this end-to-end, including the GPT-4o-mini Vision extraction and the confidence-routing gate that keeps misreads out of your P&L. It's part of The Complete n8n Templates Bundle, a one-time lifetime license to the whole catalog plus every template added later, worth it if you run more than one of these automations.

Get the ReceiptLedger template →

A workflow that turns a forwarded receipt into a clean P&L row makes month-end a query instead of a chore. For the bigger picture, see how this connects to finance automation across the books, and if invoices flow out as well as in, pair it with the Automated Invoice Chase & Escalation template to keep receivables moving too.

See the ReceiptLedger template →
FAQ

Common questions

Does n8n need a separate OCR service to read receipts?
Not anymore. Older workflows chain Azure Computer Vision or OCR.space for text extraction, then a second model to interpret it. GPT-4o-mini Vision reads the image and returns structured fields in one call, so the workflow drops a whole service and a credential. Fewer moving parts, fewer ways to break.
How do I avoid logging a misread receipt?
Ask the model for a confidence score alongside the fields, then route on it with an IF node. High-confidence extractions append to the main P&L tab; low-confidence or unreadable ones go to a separate Errors tab for a quick manual check. Most tutorials skip this and silently log garbage; the confidence gate is what makes the output trustworthy.
Can receipts come in by email instead of a chat app?
Yes, and for bookkeeping that's usually better. The workflow polls Gmail every few minutes for messages with attachments, pulls the first attachment, and runs it through Vision. Forwarding a receipt to one inbox is lower-friction than opening a Telegram bot, and it keeps a copy in your mail archive automatically.
What fields can it extract from a receipt?
Vendor name, date, amount, tax, currency, and a spending category, returned as structured JSON by GPT-4o-mini Vision. A Code node parses that JSON before the Sheets append, so each receipt lands as a clean, timestamped row ready for month-end totals and a category breakdown.
Stop reading. Start running.

Get the workflow templates this guide is built on

Import-ready n8n JSON, step-by-step setup, and tested end-to-end. One-time payment, own it forever.

Free — $40 value

Get 3 tested n8n templates, free

The full customer package for three real catalog templates — workflow JSON, step-by-step setup guide, credential checklist. Built through the same live-instance release process as everything we sell. Plus new templates and automation guides in your inbox. No spam, unsubscribe anytime.

  • 01Smart To-Do List ManagerPre-built n8n workflow template that automates productivity with OpenAI. Live in about 10 minutes.$14
  • 02Email Follow-Up AutomatorPre-built n8n workflow template that automates crm with OpenAI. Live in about 15 minutes.$12
  • 03Market Trend AnalyzerPre-built n8n workflow template that automates data processing with OpenAI. Live in about 10 minutes.$14