OperateAI
← All playbooks
Finance & Operations6 min read

Invoice Automation Playbook

Login-walled invoices, pulled, read, checked, and filed on their own with n8n and Gemini.

Ajay Singhadiya

Ajay Singhadiya

Founder, OperateAI

invoices processed / month
1,600+
invoices processed / month
saved every day
2.5 hrs
saved every day
duplicate + fake detection
Auto
duplicate + fake detection

Numbers are from the live system over a full month of runs.

The problem

The invoices lived inside vendor portals, and every portal needed its own login. Someone on the team signed into each one, downloaded the PDFs by hand, and typed the vendor, invoice number, date, and total into the accounting sheet.

It ate 150 to 160 minutes a day. Worse, duplicate invoices and lookalike fake ones still slipped through, because catching them depended on a tired human remembering what they had already seen.

How it works

  1. Trigger and pull the invoice list

    A Gmail trigger starts the run when an invoice email arrives. n8n then pulls the list of pending invoices from the vendor portal using saved login cookies, so there is no browser session to babysit.

  2. Download each invoice, authenticated

    The workflow loops over the pending invoices and downloads each file using the same authenticated session, one by one.

  3. Read it with Gemini

    Each invoice image goes to Gemini, which extracts the vendor, invoice number, date, and total into clean structured data, even on messy scans and odd layouts.

  4. Check for duplicates and fakes

    A rule check compares every invoice against the master sheet on number, vendor, and amount. Exact repeats and suspicious near-matches get flagged instead of quietly passing through.

  5. File the clean ones, alert on the rest

    Verified invoices append straight to the Google master sheet. Flagged ones fire an alert email, so a human only looks at the few that actually need a second pair of eyes.

Built with

n8nGoogle GeminiCookie-based authGoogle SheetsGmail

Get the workflow

Take the whole thing with you

  • The full n8n workflow, import-ready
  • The Gemini extraction prompt
  • The duplicate and fake-detection logic
  • Setup notes for portal logins and the accounting sheet

Bring your own Gemini API key and vendor portal login cookies. Works on n8n cloud or self-hosted.

FAQ

Questions

Most portals that let you log in and download invoices will work. Each portal needs its login cookies captured once, then n8n reuses them on every run. Portals with heavy bot protection need a small extra step, which the setup notes cover.
Two running costs: your Gemini API usage (a few paise per invoice at current rates) and n8n hosting (free if self-hosted, or a low monthly plan on n8n cloud). For 1,600 invoices a month this typically lands well under ₹2,000 total.
The workflow runs on your own n8n instance, so the invoice files and credentials stay in your environment. Only the extraction step sends the invoice content to Gemini. You can swap Gemini for another model if your policy requires it.
Let's Build

Ready to get your time back?

Book a free 30-minute call. No pitch, no commitment, just a straight answer on where AI would save your business the most time and money right now.

Book a Free Call →
Free 30-minute callNo pitch, no commitment