Reads each invoice that arrives in Gmail, checks it against its purchase order, and asks your finance manager only when it is off.

UsesClaudeGmailGoogle Sheets

Check invoices against purchase orders

Checking every invoice against its purchase order by hand is slow, and most of them are fine. When an email with an invoice attached arrives, this reads the vendor, amount and PO number from the PDF and looks the order up in your Purchase Orders sheet.

An invoice within 5% of its order is approved automatically. One more than 5% over, or with no matching order, goes to your finance manager to approve or reject. Every invoice and its outcome is added to your Invoice log sheet.

GmailGmailWhen an email arrives. Save it as invoice_email.When an email arrives. Save it as invoice_email.
ValuesPurchase orders sheetSet poSheet to blank.
ValuesInvoice log sheetSet logSheet to blank.
ValuesFinance manager's emailSet financeManagerEmail to blank.
GmailDownload the invoiceDownload the attachments on email invoice_email. Save it as attachments.Gmail
AI AgentVendor, amount and PO number on the invoiceRun an AI agent: Read this invoice and save it as invoice.
Google SheetsLook up the purchase orderRead the rows of poSheet. Save it as po.Google Sheets
ValuesSet result to Approved automatically.Set result to Approved automatically.
MathHow far the invoice is over the PO (%)Work out the percent change from po.rows[0].Amount to invoice.output.amount and save it as percent_over_po.
Decisions & LoopsIf po.count is 0 or percent_over_po is greater than 5If po.count is 0 or percent_over_po is greater than 5
Yes
ApprovalsAsk the finance managerRequest approval: Approve invoice from invoice.output.vendor that is over its purchase order or has none Save it as decision. Who to ask: financeManagerEmailInvoice from invoice.output.vendor for invoice.output.amount, PO number invoice.output.po_number. The purchase order on file is for po.rows[0].Amount (blank means no purchase order with that number was found). An invoice is checked when it is more than 5% over its order or h...
ValuesChange result to decision.decision.Change result to decision.decision.
No
No steps
Google SheetsRecord the result in the invoice logAdd a row in logSheet. Save it as logged.Google Sheets