Starbase / 02 RecipeAgents

RecipeAgents / Guides

Agent recipe guide

AI invoice extraction automation

Invoices arrive as PDF attachments scattered across your inbox, and someone has to type them into a sheet or accounting tool. This recipe uses Zapier and ChatGPT to pull the key fields out and log them, with a duplicate check, so your bookkeeping starts from a clean list.

The prompt

Extract from this invoice text: vendor, invoice_number, date, currency, net, VAT, total. Return JSON; null if missing. Text: {{pdf_text}}

Step by step

  1. Trigger: new Gmail email with a PDF attachment (use a search filter like 'invoice OR receipt').
  2. Convert the PDF to text with a PDF parsing step.
  3. Send the text to ChatGPT with the extraction prompt.
  4. Append the fields to a Google Sheet, or create a bill in QuickBooks.
  5. Flag duplicates by checking vendor plus invoice_number before writing.
SPONSOR SLOT · AVAILABLEFeature your product here

Why 'null if missing'

Telling the model to return null for missing fields stops it from guessing. A null VAT field is a clear signal for a human to check; an invented one would silently corrupt your books.

Checks worth adding

Verify that net plus VAT equals total and flag rows where it doesn't. Keep the original PDF link in the sheet so anyone can check a row. Route anything over a set amount to a person for review before it reaches QuickBooks.

Mistakes to avoid

Writing straight into accounting software without a review step in the first weeks.

Relying on text extraction for scanned image PDFs; those need OCR first.

Ignoring currency: store it with every amount.

Build it in Make, Zapier or n8n

The recipe is tool-agnostic. Every step maps to a standard building block: a trigger from the app where the data starts, an AI step that sends text to a model with the prompt, a parser that reads the JSON or text that comes back, and actions in the destination apps. Zapier is the quickest to get running for linear flows. Make makes branching and loops easier to see. n8n can be self-hosted if you want to keep data on your own infrastructure. Pick the one your team already pays for.

Test it before you trust it

Run the recipe on ten to twenty real examples before you switch it on for everything. Put the inputs and outputs side by side in a sheet and mark each one right or wrong. Where it's wrong, add one specific line to the prompt that addresses the pattern, then run the same examples again. Keep a human approval step on any action that is visible to customers or touches money until the error rate is one you'd accept from a new hire.

Watch running costs as well. Each AI step is billed by the model provider and each task or operation by the automation tool. Filtering inputs before the AI step, for example skipping newsletters or tiny files, is the easiest way to keep both down. Check current pricing on each vendor's site, since it changes often.

Before you use it

Every recipe on RecipeAgents follows the same shape: a trigger, the tools, the steps, and the exact prompt. Start with the human-approval version. Once you have watched a few dozen runs and trust the output, decide which steps can run on their own. Model and tool names change often, so check current pricing and features in each tool before you build.

Frequently asked questions

Can ChatGPT read invoices?
It can extract fields from invoice text reliably for common layouts. Always validate totals and keep the original.
Google Sheets or QuickBooks?
Start with Sheets for review. Move to direct QuickBooks bills once the extraction is consistently correct.
What about receipts photographed on a phone?
Those need an OCR step before the extraction prompt.

More guides

Back to all of RecipeAgents

Newsletter

Get one new agent recipe every week

Free. No spam. Unsubscribe anytime.