workflows.fit
Back to n8n workflows
n8n templateFreeBy Pratyush Kumar Jha

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

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 field...

Data & StorageProductivityCommunicationHITLDevelopmentCore NodesAILangchain
Loading interactive preview...

Template notes

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

- Trigger: Form submission or scheduled fetch (sample On form submission node included) - AI Filter: Guardrail node determines whether an email is finance-related (payments, invoices, receipts) - Keyword Filter: Filters common invoice/bill/payment subject keywords - Extraction: Language-model agent returns normalized JSON: - vendorname - invoicedate (YYYY-MM-DD) - invoiceid - totalamount - taxamount - currency - itemssummary - vendortaxid - Validation: Code node checks required fields and amount formats; flags extraction errors - Categorization: Rule-based expense categorizer (software & hosting, subscriptions, travel, payroll, etc.) with MCC/vendor fallbacks - Output: Appends structured rows to a Google Sheet with mapped columns: - invoiceid, vendorname, invoicedate, totalamount, currency, taxamount, glcategory, approvalstatus, timestamp, caseid, itemssummary, vendortaxid, processedat - High Accuracy: Low false-positive rate using combined AI guardrails + subject filtering - Quick Setup: Example nodes and credentials pre-configured in the template

---

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.)