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

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