Templates / AI Invoice Email Extractor to Google Sheets

AI Invoice Email Extractor to Google Sheets

Intermediate   Apps: Email IMAP, OpenAI, Google Sheets  ·  Setup: 15 minutes

Month-end bookkeeping is an archaeology dig through your inbox for invoices and receipts. OCR-based expense tools charge per document and still botch layouts they haven't seen. This workflow watches a mailbox, has GPT-5.6 read each billing email, and appends structured fields to Google Sheets. Language models handle weird formats - forwarded chains, foreign currencies, plain-text receipts - better than template OCR ever did.

Download workflow JSON (free) Setup guide

What this workflow does

  1. An Email (IMAP) trigger watches your inbox or a dedicated invoices@ address.
  2. A Code node pre-filters: only emails that look like invoices or receipts continue (keywords in subject or sender).
  3. An OpenAI node extracts vendor, amount, currency, invoice number, invoice date, and due date as JSON - or NOT_INVOICE if it's a false positive.
  4. A Code node validates the JSON and drops non-invoices.
  5. A Google Sheets node appends the row to your ledger.

Setup guide

  1. Import the JSON into n8n (Workflows > Import from File).
  2. Connect the IMAP node to the mailbox that receives invoices (host, port 993, app password).
  3. Add your OpenAI API key.
  4. Connect Google Sheets (columns: Received, Vendor, Amount, Currency, InvoiceNumber, InvoiceDate, DueDate, Subject).
  5. Activate, then forward yourself an old invoice email to test.

Want this running 24/7?

Self-host n8n on a cheap VPS and this workflow runs around the clock for less than a coffee a month.

Get an n8n VPS from $5/month

FAQ

Does it read PDF attachments too?This template reads the email body, which covers most receipts. For PDF invoices, add an Extract From File node (PDF to text) after the trigger and include the text in the AI prompt.
How do I keep personal email out of the AI?The pre-filter only passes emails whose subject or sender matches billing keywords (invoice, receipt, payment, billing). Everything else never reaches the AI step. A dedicated invoices@ alias is even cleaner.
What about accuracy for accounting?Treat the sheet as a draft ledger: the AI is right the vast majority of the time, and the Subject column links back so you can spot-check amounts before filing. It replaces the typing, not the review.

Want the workflows this one is a warm-up for?

The Mega Bundle packs both WorkflowForge Pro volumes — 32 production-grade workflows: automations (cart recovery, lead scoring, invoice extraction) and AI agents (support agent, calendar assistant, research agent), each with a setup guide. $39 for both, instant download.

Get the Mega Bundle →

Need it customized for your exact process?

I build custom n8n automations and AI agents professionally: your tools, your edge cases, tested and documented.

Hire me on Fiverr →