Templates / Extract, validate, and log email invoices from Gmail to Google Sheets with GPT-4

Extract, validate, and log email invoices from Gmail to Google Sheets with GPT-4

Needs changes

by Pratyush Kumar Jha ✓ · 146 views · created 2026-02-04 · Invoice Processing, AI Summarization

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 12 nodes and runs when someone submits an n8n form (“AI Financial Mail Detector and Summarizer”). Along the way it connects Gmail, Guardrails, Google Sheets and OpenAI Chat Model.

How it runs

Trigger: When someone submits an n8n form (“AI Financial Mail Detector and Summarizer”).

  1. Get Email Content (Gmail): get many
  2. Guardrail: Is Finance? (Guardrails): uses Guardrails, with model: OpenAI Chat Model
  3. If: checks a condition and branches into true / false
  4. Filter: keeps only the items that match a condition
  5. AI Agent: runs an AI agent, with model: gpt 4o mini
  6. Validate Extraction (Code): runs custom JavaScript code
  7. Check for Errors (If): checks a condition and branches into true / false
  8. Apply Finance Rules (Code): runs custom JavaScript code
  9. Log to Invoices Sheet (Google Sheets): append

Services it uses

GmailGuardrailsGoogle SheetsOpenAI Chat Model

Before you upgrade to n8n 3.0

1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:

  • AI Agent v1 (old agent modes) in AI Agent (Email OCR) (v1.9): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).

Removed in 3.0Replace with
AI Agent v1 (old agent modes)
AI Agent (Email OCR) (v1.9)
Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Nodes used (9)

From the author

Inbox2Ledger is an end-to-end n8n template that turns a noisy finance inbox into a clean, structured ledger. It fetches emails, uses AI guardrails to keep only finance-relevant messages, extracts invoice/receipt fields via an OCR-style agent, validates and…

Excerpt from Pratyush Kumar Jha's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.