More

Book a free call
Fixed price in writing before we start

AI invoice approval: Claude reads the invoice, code checks the totals and duplicates

Invoices land in a Google Drive folder, and someone has to retype, check and approve them. This n8n workflow gives Claude the PDF or photo to read, but arithmetic, duplicates and the approval threshold are checked in code. Above the threshold a person decides.

Author

Published:
Last verified:
n8n version:
2.8.4

In short

What it does

  • Watches a Google Drive folder and downloads each new invoice
  • Extracts fields from a PDF or image with Claude vision
  • Checks in code that subtotal plus tax equals the total
  • Looks for a duplicate invoice number in a Google Sheets ledger
  • Approves small amounts on its own and sends larger ones to a person with links

What it does not do

  • Does not replace structured e-invoicing such as Poland's KSeF
  • Cannot tell the same invoice number from two vendors apart
  • Does not convert currencies when comparing with the threshold
  • Does not make the payment

What it needs

  • n8n (tested on 2.8.4)
  • Google Drive and Google Sheets
  • An Anthropic API key
  • A webhook URL for notifications (Slack, Teams or similar)

AI invoice approval: Claude reads the invoice, code checks the totals and duplicates

The process looks much the same in most small companies. An invoice arrives by email, someone saves it to a folder, retypes the amounts into a spreadsheet, checks it was not paid already and asks the boss to approve. Retyping takes the most time; approving without checking carries the most risk.

This n8n workflow splits the work so the model only does what it is good at: reading the document.

Workflow canvas for invoice approval: a Google Drive trigger, Claude vision extraction, arithmetic and duplicate checks, automatic or human approval, ledger logging and moving the file
The whole pipeline. The model only reads the invoice; totals, duplicates and the approval threshold are checked by code.

The model reads, it does not add up

The file from Drive goes to the Anthropic API as a document block (PDF) or an image block (photo). The prompt asks for JSON only and forbids guessing:

If a field is not visible, use null. Never guess a plausible-looking number.

If the response cannot be parsed, the invoice does not crash the workflow. It gets an extraction_failed flag and goes straight to a person. An unreadable invoice is exactly the case someone should see.

Three checks the model does not do

arithmetic-check.js
const diff = Math.abs((sub + tax) - tot);
math_ok = diff < 0.02; // rounding tolerance

Subtotal plus tax must equal the total to within two cents. A mismatch means either a reading error or an error on the invoice. Either way there is no auto-approval, whatever the amount.

The second check is the duplicate: the workflow looks the invoice number up in a Google Sheets ledger. The third is the amount threshold (500 by default).

SituationWhat happens
unreadable, totals do not match, or a duplicateto a person, whatever the amount
amount below the thresholdapproved automatically
amount at or above the thresholdto a person

The message to the approver goes to a webhook (Slack, Teams, anything that accepts JSON with a text field) and carries the reason plus two links: approve and reject. The links point at the Wait node's $execution.resumeUrl, so the workflow simply waits for the click.

After the decision, the invoice is written to the ledger with the check results, the approval type and the running spend with that vendor, and the file moves to a "processed" or "flagged" folder.

Limitations

Duplicates are checked on the invoice number alone. Two vendors that both send invoice "1/11/2026" produce a false duplicate. A safer key is the number plus the vendor's tax ID or name.

The Google Drive trigger polls the folder every minute. Several files dropped at once arrive in one run, while the later steps are written for one invoice at a time. For bulk uploads, process files one by one.

The threshold compares the gross amount regardless of currency.

In Poland, since 2026 most business-to-business invoices go through KSeF as structured XML. Those do not need a model to read them. This workflow fits foreign invoices, receipts, bills from outside KSeF and scans.

When it does not make sense

With a dozen invoices a month, manual approval is faster than maintaining another automation. The workflow starts paying off with hundreds of documents and several people in the approval chain. If invoices should flow into accounting software, with approval permissions, history and deputies, that is a process automation project, not a single workflow. We use the same split between model and code when analysing supplier price lists.

Take it with you

How to cite this

Adrian Hunia (2026). AI invoice approval: Claude reads the invoice, code checks the totals and duplicates. SEVENEDGE. https://sevenedge.pl/en/workflows/akceptacja-faktur-ai-claude-vision (accessed: November 5, 2026)

Sources

  1. Claude docs — PDF supportAPI docs
  2. n8n docs — Waitn8n docs
  3. n8n docs — Google Sheetsn8n docs

Who is behind this

Adrian Hunia

Co-founder of SEVENEDGE

Co-founder of SEVENEDGE. Designs and deploys business systems for small companies, from production management to time tracking. Works with Next.js, FastAPI and PostgreSQL. SEVENEDGE has no subcontractors — both owners write the code.

Related documents

Other workflows we documented the same way.

7SVENAI assistant, not a human

You are chatting with an AI assistant. Replies are generated by artificial intelligence (Cerebras) and may contain mistakes. Please do not share sensitive data in the chat.

Your personal data is controlled by SEVENEDGE ADRIAN HUNIA. We use your chat messages to answer your questions and, if you ask, to book a meeting. Details and your rights: Privacy policy.

Hi! I'm SVEN, the SEVENEDGE AI assistant. We build apps, SaaS and AI automations. How can I help?
SVEN, the SEVENEDGE mascot, looking through a requestSVEN, the SEVENEDGE mascot, thinking over a coffeeSVEN, the SEVENEDGE mascot, working at a laptop
Got an app idea?