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.
27/11/2026 and 1.234,56, then checks the printed line totals against the printed total.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.
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.
An n8n instance, cloud or self-hosted (v1.0+), plus:
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.
unmatched instead of being forced onto the wrong SKU.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.
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.
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.
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.
30-day no-questions refund if it does not match this description.