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

โšก 58 views ยท ๐Ÿงพ Invoice Processing

Description

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 auto-categorizes each expense, generates a unique case ID, and appends the result to a Google Sheet for accounting or downstream automations.


Key Features


Included Nodes & Flow Highlights

On form submission (date picker trigger)
โ†’ Get Email Content (Gmail)
โ†’ Guardrail: Is Finance? (LangChain Guardrails)
โ†’ IF (Guardrail Passed)
โ†’ Filter Finance Keywords
โ†’ AI Agent (Email OCR)
โ†’ Validate Extraction
โ†’ Check for Errors
โ†’ Apply Finance Rules
โ†’ Log to Invoices Sheet (Google Sheets)

(Full node list and configuration included in the template.)


Requirements & Credentials

Recommended: Use the Google Sheet ID included in the template, or replace it with your own Sheet ID and gid.


Quick Setup Guide

๐Ÿ‘‰ Demo & Setup Video

  1. Import the template into n8n
  2. Connect and authorize credentials: Gmail, Google Sheets, OpenAI (or preferred LLM)
  3. Update the Google Sheet ID / sheet gid if using your own sheet
  4. (Optional) Adjust the Guardrail topicalAlignment threshold or filter keywords
  5. Test using the form trigger or a single email, then enable the workflow

Configuration Tips


Privacy & Security


Example Use Cases


finance, invoices, email, ai, ocr, google-sheets, automation, accounting, n8n-template

๐Ÿ”— Nodes Used

Google Sheets, Gmail, Filter, AI Agent, OpenAI Chat Model, n8n Form Trigger

๐Ÿ“ฅ Import

Download workflow.json and import into n8n: Workflow menu โ†’ Import from File

๐Ÿ“– Importing guide ยท ๐Ÿ”‘ Credential setup