Skip to content
NEWMeet Alaaddin, your AI genie with a voice. trig8n launches 1 January 2027. See what is new

Library / Documents, PDF & OCR

Documents, PDF & OCR

Match supplier invoices to purchase orders with Gmail, OpenAI, and Data Tables

When a new email arrives, it reads and extracts data from documents with OpenAI / ChatGPT using Data Table, Gmail.

What it does

## Match every supplier invoice against the purchase order before it gets paid The invoice arrives as a PDF on an email. This reads it, finds the purchase order it belongs to, and stops the ones that do not line up - duplicates, overcharges, and invoices for something nobody ordered. ### How it works Read The PDF turns the attachment into text and Pull Out The Invoice Fields asks a model for the invoice number, vendor, PO reference, currency and total exactly as printed. It is never asked for a number: 1.234,50 and 2,600.00 are both real, and parseFloat reads the first as 1.234. Parse The Money decides the separator by which one comes last. Match It Against A Purchase Order finds the PO by reference, or by vendor and amount when the invoice quotes none. Vendor names compare with the suffixes stripped, so Nordwind Analytics BV and Nordwind Analytics are one supplier. Then four checks: already seen, wrong currency, over tolerance, no order at all. Clear invoices are logged and you hear nothing. Everything else gets a written reason, a row in the table, and a draft reply in the supplier's own thread for you to read and send. ### Setup 1. A Gmail credential, and a label your supplier invoices land on. 2. A Data Table called purchase_orders with columns po_number, vendor, amount, currency and status. Put your open POs in it. 3. A Data Table called invoices_seen with columns invoice_key, invoice_number, vendor, amount, currency, po_number, status, reason and seen_on. 4. An OpenAI-compatible key on the model node, and your tolerance in Settings.

The steps

  1. Watch The Invoice Label
  2. Settings
  3. Keep Only The PDFs
  4. Is There An Invoice Attached?
  5. Read The PDF
  6. Pull Out The Invoice Fields
  7. Model
  8. Parse The Money
  9. Read The Open Purchase Orders
  10. Read The Invoices You Have Seen
  11. Everything In Hand
  12. Match It Against A Purchase Order
  13. Is It Clear To Pay?
  14. Log It As Cleared

19 steps in total.

Similar automations