← Back to projects

Automation project

Invoice reader with n8n

An n8n workflow for supplier invoices: you upload the PDF to a form, an AI model extracts supplier, tax ID, number, date, amounts and currency, the workflow checks everything adds up and that it isn't a duplicate, logs it in Google Sheets and, if something's wrong, alerts me by Gmail. Here you can try the same logic in your browser.

In the demo, PDFs are read in your browser and never sent anywhere. The sample invoices are from fictitious companies.

The n8n workflow

Trigger

  1. Upload Invoiceweb form to upload the PDF

Extract invoice data

  1. Extract PDF Textextracts the PDF text
  2. Extract Invoice Fieldsan OpenAI model reads the 8 fields

Validate and record

  1. Validate Datarequired fields and net + VAT = total
  2. Find Existing Invoiceslooks up the number in Google Sheets
  3. Compute StatusOK, REVIEW or DUPLICATE and the reason
  4. Append Invoice Rowadds the row to the Invoices sheet

Alert on problems

  1. Needs Alert?is the status not OK?
  2. Send Alert EmailGmail alert with the details

These are the real nodes of the exported n8n workflow. While an invoice is processed, the node it's on lights up. In n8n an OpenAI model reads the fields; in the demo I do it with rules in the browser so your invoices never leave your device.

Screenshot of the workflow in the n8n editor: Upload Invoice, the Extract invoice data block with Extract PDF Text, Extract Invoice Fields and OpenAI Chat Model, and the Validate and record and Alert on problems blocks.
The workflow in my n8n editor, with nodes grouped into blocks.

Try the workflow

How it works

  • Input and extraction

    The invoice comes in through an n8n form. The PDF text goes to an Information Extractor with an OpenAI model, which returns 8 fields: supplier, issuer tax ID (not the customer's), number, date, net, VAT, total and currency. If a field is missing it leaves it blank rather than guessing.

  • Validation

    A code node checks that no field is missing and that net + VAT = total, with a 2-cent tolerance for rounding.

  • Duplicates

    It looks up invoices with the same number in Google Sheets and flags a duplicate if the tax ID or supplier name also match, so the same invoice is never paid twice.

  • Log and alerts

    Each invoice is appended to the sheet with its status, reason and processing time. If the status isn't OK, the workflow emails all the details for review.

Educational demo reproducing the logic of my n8n workflow; sample invoices use fictitious data.