Maui Tech HubMaui Tech Hub
Maui Tech HubMaui Tech Hub.
Supplier Invoice Reconciler

Every supplier invoice, in your sheet, before you pay it

Finance & AccountingadvancedGmailOpenAIGoogle SheetsTelegram

A supplier emails the invoice. One person opens the PDF, types twelve lines into a sheet, and guesses that the price is roughly what it was last month. Three months later the margin is gone and nobody can say when it moved. This workflow does the typing, keeps the price history, and speaks up when a total does not match its own lines.

What you get

  • supplier-invoice-reconciler.json — 22-node n8n workflow, imports into n8n 1.x and 2.x
  • two input paths — a PDF with a text layer is read as text; a phone photo goes to the model as an image
  • three sheet tabs — Stock (yours, one row per SKU), InvoiceLines (one row per line), PriceChanges (one row per move)
  • setup notes on the canvas — exact column headers, credentials, the Gmail search query
  • Lifetime updates — buy once, get future versions free

How it works

  • Invoice Email — Gmail Trigger polls unread mail that has an attachment and an invoice subject (English, Spanish or Arabic).
  • Split Attachments — one email can carry four files. Each file becomes its own invoice item, and keeps the sender and filename.
  • PDF or Image? — PDFs go to text extraction; JPG, PNG, WEBP and HEIC photos go to the model as images.
  • Ask the Model — one gpt-4o-mini call per invoice. JSON only: supplier, number, date, currency, tax, total, lines.
  • Normalise Invoice — fixes 27/11/2026 and 1.234,56, then checks the printed line totals against the printed total.
  • Read Stock — your own sheet, the price you last paid per SKU.
  • Match to Stock — barcode match when printed, name-token match when not, cost comparison per line.
  • Log Invoice Lines / Log Price Changes — appends to two tabs. No changes means no rows, so the second append is skipped.
  • Telegram Summary — one message per invoice. A second message only when a human needs to look.

What the output looks like

Real output from a test run of the matching logic, against a stock sheet with three SKUs and an invoice with four lines, one of them not on file:

INVOICE INV-8842 - Al Noor Trading Co.
2026-11-27 | 4 lines | KWD 402.750
Matched 3 of 4 against stock | 1 price change(s)
Price moves: Sugar white 1kg +12.7%
New or unknown: Aluminium foil 30cm

CHECK THIS INVOICE: INV-8842 from Al Noor Trading Co.
- Lines add up to 346.5 but the invoice total says 402.75 (off by -56.25)
- 1 line(s) not found in your stock sheet: Aluminium foil 30cm
- 1 cost price change(s) of 10% or more

That is the whole point: the numbers that disagree with each other are the ones that cost money, and they are the first thing you see.

Why price changes are the product

Suppliers raise prices quietly, in the middle of a long invoice, one line at a time. Retyping invoices tells you nothing about that. This workflow keeps last_cost in your own sheet, so every invoice is also a price audit: any line that moved more than price_alert_pct (10% by default) is written to PriceChanges with the old price, the new price and the percentage. Six weeks of that is a negotiating file.

Requirements

An n8n instance, cloud or self-hosted (v1.0+), plus:

  • a Gmail account that receives supplier invoices (OAuth2)
  • an OpenAI API key (gpt-4o-mini; about $0.002 per invoice)
  • one Google Sheet with three tabs and exact headers, listed in the setup note
  • a Telegram bot token and your chat id for the summary messages

22 nodes. Setup is 15-20 minutes the first time: create the tabs, paste the sheet URL, attach four credentials, send yourself a test invoice.

What it does not do

  • It is not a purchase-order three-way match. It does not compare invoice against PO against goods received; it maintains your cost prices and your line ledger.
  • A scanned PDF with no text layer is flagged, not read. Photograph the page instead — the image path handles that.
  • It does not guess. A missing price stays empty and the invoice is flagged.
  • Fuzzy matching is not a barcode scanner. Below 62% name similarity a line is marked unmatched instead of being forced onto the wrong SKU.
  • No currency conversion. Amounts stay in the invoice currency.
  • Credit notes and returns are matched like any other line; nothing special is done for them in v1.
  • Ships without credentials or sample data.

FAQ

Do I have to use Gmail?

The trigger is Gmail. The rest of the chain (split, extract, match, log, alert) is trigger-agnostic: swap in an IMAP trigger or a Telegram trigger and the same nodes run. Both are stock n8n nodes.

Will it work with Arabic invoices?

Yes. The extraction prompt keeps item names in their original language, and the matcher normalises Arabic letters (alef forms, taa marbuta, yaa) before comparing names. That path was tested with an Arabic item name matching an Arabic stock row.

What if a supplier sends an invoice every day?

It runs on the poll interval you set (every minute by default) and handles every file in every matching email. At 60 invoices a month the model cost is about 12 cents.

How was it tested?

The parsing, matching and flattening code was executed against sample invoice data outside n8n (including European decimal commas, a broken model response and an Arabic item name), and the workflow JSON was imported into n8n 2.36 before listing. The Gmail, OpenAI and Sheets calls need your own credentials, so those were not run here.

Refunds?

30-day no-questions refund if it does not match this description.