Extracting invoices from Gmail with n8n and Gemini, then checking the IBAN before anyone pays it
Description and use
Automating invoice extraction from Gmail with n8n and Gemini, supplemented by IBAN validation via a Cloudflare Worker, ensures reliable data capture and prevents payments to incorrect bank accounts.
Problem
LLMs can extract invoice data but may misread IBANs, leading to payment errors.
Outcome
Invoices are reliably extracted, mathematically validated, and IBANs are checked before payment, reducing risk of incorrect payments.
Workflow
- Gmail Trigger polls unread emails labeled 'invoices' with PDF attachments
- Split PDF Attachments creates one item per PDF
- Extract From File reads PDF text layer
- Gemini + Structured Output Parser returns strict JSON with vendor, invoice number, PO number, dates, currency, subtotal, tax, total, line items and confidence
- Normalize Invoice cleans numbers, checks subtotal+tax=total, marks low-confidence rows as 'needs_review'
- Google Sheets appends row and marks email read
- HTTP Request node posts batch of identifiers to validation API
- API returns validation results; rows with valid=false or checked=false are flagged for review
Evidence
Most invoice automations stop at extraction: an LLM pulls the vendor, total and bank details out of a PDF, and the numbers go straight into a spreadsheet or ledger.
Extraction confidence doesn't tell you whether an IBAN is real. The ISO 13616 mod-97 checksum does.
Up to 50 identifiers per batch request.
- Record date: 2026-10-18T17:56:14.481Z