Expense Organizer with Google Drive Routing and Gemini AI Entity Detection
Last edited 58 days ago
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:
-
Form Submission: Users submit expenses through a web form with receipt upload and category selection (Personal, Business, or Shared/Home)
-
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
-
Smart Routing: Based on the expense category, receipts are automatically routed to different processing paths with category-specific folder organization
-
Multi-Destination Storage: Receipts are uploaded to:
- Google Drive (organized by year/month folders)
- S3 cloud storage buckets
- Different destinations based on expense type
-
Email Notifications: Sends formatted HTML email notifications with complete expense details and links to stored receipts
-
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
- Set up Google Gemini API credentials in n8n
- Configure Google Drive OAuth2 for both personal and business accounts
- Add Gmail OAuth2 credentials
- Set up S3 storage credentials
Step 2: Update Configuration
-
Replace all placeholder values:
YOUR_GEMINI_CREDENTIAL_IDwith your Gemini credential IDYOUR_PERSONAL_GDRIVE_CREDENTIAL_IDwith personal Drive credentialYOUR_BUSINESS_GDRIVE_CREDENTIAL_IDwith business Drive credentialYOUR_GMAIL_CREDENTIAL_IDwith Gmail credentialYOUR_S3_CREDENTIAL_IDwith S3 credential
-
Update Google Drive folder structure:
- Replace
YOUR_BUSINESS_DRIVE_IDandYOUR_SHARED_DRIVE_IDwith actual drive IDs - Update the JavaScript code in the three Code nodes with your actual folder mapping
- Replace
-
Configure email addresses:
- Replace
[[email protected]](/cdn-cgi/l/email-protection)with your notification email - Replace
[[email protected]](/cdn-cgi/l/email-protection)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)
- Replace
-
Update S3 bucket names:
- Replace
business-expenses,personal-expenses, andshared-expenseswith your bucket names
- Replace
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
- Activate the workflow
- Submit a test expense through the form
- Verify files are uploaded to correct locations
- 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
You may also like
New to n8n?
Need help building new n8n workflows? Process automation for you or your company will save you time and money, and it's completely free!





