Skip to main content

Expense organizer with Google Drive routing and Gemini AI entity detection

Workflow preview

Workflow preview
100%
Expense organizer with Google Drive routing and Gemini AI entity detection preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Who's it for This workflow is perfect for individuals, small businesses, or households who need to: Automatically process and categorize expense receipts Extract structured data from invoices and r...

Best for

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

Tools used

n8n-nodes-base.if, n8n-nodes-base.formtrigger, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatgooglegemini, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.googledrive, n8n-nodes-base.code

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Expense organizer with Google Drive routing and Gemini AI entity detection
Workflow name
Expense organizer with Google Drive routing and Gemini AI entity detection

Who's it for

This workflow is perfect for individuals, small businesses, or households who need to:

  • Automatically process and categorize expense receipts
  • Extract structured data from invoices and receipts using AI
  • Store receipts in multiple locations (Google Drive and S3)
  • Send automated email notifications with expense details
  • Send documents to accounting systems via email hooks

How it works

This comprehensive expense processing workflow combines AI-powered document analysis with automated file management and notifications. Here's the complete flow:

  1. Form Submission: Users submit expenses through a web form with receipt upload and category selection (Personal, Business, or Shared/Home)

  2. AI Document Processing: The workflow extracts text from PDF receipts using OCR, then uses Google Gemini AI to parse and structure the data into a standardized JSON format including vendor details, amounts, dates, and categorization

  3. Smart Routing: Based on the expense category, receipts are automatically routed to different processing paths with category-specific folder organization

  4. Multi-Destination Storage: Receipts are uploaded to:

    • Google Drive (organized by year/month folders)
    • S3 cloud storage buckets
    • Different destinations based on expense type
  5. Email Notifications: Sends formatted HTML email notifications with complete expense details and links to stored receipts

  6. Accounting System Integration: Automatically forwards business expenses to accounting systems via email hooks (customizable per user requirements)

Requirements

Credentials needed:

  • Google Gemini API: For AI-powered document analysis
  • Google Drive OAuth2: For personal and business drive access
  • Gmail OAuth2: For sending email notifications
  • S3 Storage: For cloud backup (AWS S3, Wasabi, etc.)

Services used:

  • Google Drive (multiple accounts supported)
  • Google Gemini AI
  • Gmail
  • S3-compatible storage
  • Form trigger webhook

How to set up

Step 1: Configure Credentials

  1. Set up Google Gemini API credentials in n8n
  2. Configure Google Drive OAuth2 for both personal and business accounts
  3. Add Gmail OAuth2 credentials
  4. Set up S3 storage credentials

Step 2: Update Configuration

  1. Replace all placeholder values:

    • YOUR_GEMINI_CREDENTIAL_ID with your Gemini credential ID
    • YOUR_PERSONAL_GDRIVE_CREDENTIAL_ID with personal Drive credential
    • YOUR_BUSINESS_GDRIVE_CREDENTIAL_ID with business Drive credential
    • YOUR_GMAIL_CREDENTIAL_ID with Gmail credential
    • YOUR_S3_CREDENTIAL_ID with S3 credential
  2. Update Google Drive folder structure:

    • Replace YOUR_BUSINESS_DRIVE_ID and YOUR_SHARED_DRIVE_ID with actual drive IDs
    • Update the JavaScript code in the three Code nodes with your actual folder mapping
  3. Configure email addresses:

    • Replace [email protected] with your notification email
    • Replace [email protected] with your accounting system's email hook (this is a mail hook for uploading documents to small business accounting systems - can be modified per user requirements)
  4. Update S3 bucket names:

    • Replace business-expenses, personal-expenses, and shared-expenses with your bucket names

Step 3: Set Up Folder Structure

Create organized folder structures in your Google Drives:

Drive Root/
├── 2024/
│   ├── January/
│   ├── February/
│   └── ... (all months)
├── 2025/
│   ├── January/
│   └── ... (all months)
└── 2026/
    └── ... (all months)

Step 4: Test the Workflow

  1. Activate the workflow
  2. Submit a test expense through the form
  3. Verify files are uploaded to correct locations
  4. Check email notifications are received

How to customize the workflow

Expense Categories

Modify the form dropdown options and conditional logic to add/remove expense categories:

  • Edit the "On form submission" node form fields
  • Update the IF condition nodes for routing
  • Add new processing paths as needed

AI Processing Schema

Customize the structured output parser schema to extract different fields:

  • Modify the JSON schema in the "Structured Output Parser" node
  • Update the AI system prompt for different extraction requirements
  • Add new fields for specific business needs

Storage Destinations

Add or modify storage locations:

  • Duplicate upload nodes for additional cloud services
  • Modify folder organization logic in Code nodes
  • Add new conditional routing for different storage rules

Email Templates

Customize the HTML email template:

  • Edit the email message content in the Gmail node
  • Add/remove expense fields in the table
  • Modify styling and branding

Folder Organization

Update the JavaScript code in Code nodes to match your folder structure:

  • Modify the CSV data with your actual folder IDs
  • Change the date-based organization logic
  • Add custom folder naming conventions

Integration Extensions

Extend the workflow with additional integrations:

  • Add Slack notifications
  • Connect to accounting software (QuickBooks, Xero)
  • Integrate with expense management platforms
  • Add approval workflows for business expenses

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 - personal

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

Block 2 - business

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

Block 3 - shared

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

Block 4 - On form submission

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

Block 5 - Extract from File

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

Block 6 - AI Agent

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

Block 7 - Google Gemini Chat Model1

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

Block 8 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 9 - Upload file

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 10 - Upload file1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 11 - Code

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

Block 12 - Code1

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

Block 13 - Code2

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

Block 14 - Upload file2

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 15 - Merge2

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 16 - Send a message

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

Block 17 - Send a message1

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

Block 18 - Sticky Note

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

Block 19 - Sticky Note1

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

Block 20 - Sticky Note2

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

Block 21 - If

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

Block 22 - Upload a file

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

Block 23 - Upload a file1

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

Block 24 - Upload a file2

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

3. Summary Table

Workflow Expense organizer with Google Drive routing and Gemini AI entity detection
Complexity advanced
Nodes 24
Categories Invoice Processing, Multimodal AI
Author Daniel Rosehill
Published 07 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7143/7143.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 Expense organizer with Google Drive routing and Gemini AI entity detection do?

Who's it for This workflow is perfect for individuals, small businesses, or households who need to: Automatically process and categorize expense receipts Extract structured data from invoices and r...

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, Multimodal AI use case.