Skip to main content

Financial document extraction from Gmail to Google Sheets

Workflow preview

Workflow preview
100%
Financial document extraction from Gmail to Google Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Manual financial reconciliation is tedious and prone to error. This workflow functions as an AI Financial Controller, automatically monitoring your inbox for invoices, receipts, and bills, extracti...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtrigger, n8n-nodes-base.gmail, @n8n/n8n-nodes-langchain.guardrails, n8n-nodes-base.set, n8n-nodes-base.if, n8n-nodes-base.filter, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.agent

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Gtaras.

Original n8n.io source

1.1 Workflow description

Title
Financial document extraction from Gmail to Google Sheets
Workflow name
Financial document extraction from Gmail to Google Sheets

Overview

Manual financial reconciliation is tedious and prone to error. This workflow functions as an AI Financial Controller, automatically monitoring your inbox for invoices, receipts, and bills, extracting the data using OCR, and syncing it to Google Sheets for approval.

Unlike simple scrapers, this workflow uses a "Guardrail" AI agent to filter out non-financial emails (like newsletters) before they are processed, ensuring only actual transactions are recorded.

Who is it for?

  • Finance Teams: To automate the collection of vendor invoices.
  • Freelancers: To track expenses and receipts for tax season.
  • Operations Managers: To monitor budget spend and categorize costs automatically.

How it works

  1. Ingest: The workflow watches a specific Gmail label (e.g., "INBOX") for new emails.
  2. Guardrail: A Gemini-powered AI agent analyzes the email text to determine if it is a valid financial transaction. If not, the workflow stops.
  3. Extraction (OCR):
    • If an attachment exists: An AI Agent (GPT-4o) extracts data from the PDF.
    • If no attachment: An AI Agent extracts data directly from the email body.
  4. Validation: Code nodes check for missing fields or invalid amounts.
  5. Business Logic: The system automatically assigns General Ledger (GL) categories (e.g., "Uber" -> "Travel") and sets approval statuses based on amount thresholds.
  6. Sync: Validated data is logged to Google Sheets, and a confirmation email is sent. Errors are logged to a separate error sheet.

How to set up

  1. Google Sheets: Copy this Google Sheet template to your drive. It contains the necessary tabs (Invoices, Error Logs, Success Metrics).
  2. Configure Workflow:
    • Open the node named "Configuration: User Settings".
    • Paste your Google Sheet ID (found in the URL of your new sheet).
    • Enter the Admin Email address where you want to receive error notifications.
  3. Credentials:
    • Connect your Gmail account.
    • Connect your Google Sheets account.
    • Connect your OpenAI (for OCR) and Google Gemini/PaLM (for Guardrails) accounts.

Requirements

  • n8n version 1.0 or higher.
  • Gmail account.
  • OpenAI API Key.
  • Google Gemini (PaLM) API Key.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Look for Invoices

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 2 - Get Email Content

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 3 - Guardrail: Is Finance?

Type / Role
@n8n/n8n-nodes-langchain.guardrails - guardrails
Config choices
Version 1

Block 4 - Configuration: User Settings

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 5 - IF (Guardrail Passed)

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 6 - Filter Finance Keywords

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 7 - Check for Attachment

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 8 - Extract PDF Data

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 9 - AI Agent (PDF OCR)

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Block 10 - AI Agent (Email OCR)

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Block 11 - Validate Extraction

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Check for Errors

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - Apply Finance Rules

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Log to Invoices Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 15 - Send Confirmation Email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 16 - Log Error to Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 17 - Send Error Notification

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 18 - Sticky Note Guardrail

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note Extraction

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note Logic

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - gpt 4o mini

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 22 - Gemini 2.5 flash

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 23 - Log Success Metrics

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 24 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 26 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Financial document extraction from Gmail to Google Sheets
Complexity advanced
Nodes 26
Categories Invoice Processing, AI Summarization
Author Gtaras
Published 27 Nov 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11290/11290.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Financial document extraction from Gmail to Google Sheets do?

Manual financial reconciliation is tedious and prone to error. This workflow functions as an AI Financial Controller, automatically monitoring your inbox for invoices, receipts, and bills, extracti...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.