🔬 Track and analyze Google Sheets expenses with Gemini and Gmail alerts

⚡ 50 views · 🔬 Document Extraction & Analysis

Description

Expense Leak Detector

Smart Expense Monitoring in Minutes


This n8n workflow reads your expenses from Google Sheets, categorizes them using predefined keywords, summarizes spending per category, generates AI-powered financial advice using Gemini, stores results in another sheet and sends email alerts for high or normal expenses.

Quick Start Guide

  1. Import the workflow into n8n

  2. Connect:

    • Google Sheets OAuth2
    • Google Gemini API
    • Gmail OAuth2
  3. Update the Settings node:

    • Budget limit
    • Recipient email
    • Sender name
  4. Ensure:

    • Sheet1 → Date, Description, Amount
    • Sheet2 → Date, Category, Total Spent, AI Report, Status, Reviewed On
  5. Click “Execute Workflow”

What It Does

This workflow automates your expense tracking and financial analysis using a combination of Google Sheets and AI.

It begins by fetching raw expense data from a Google Sheet (Sheet1), where each row contains a date, description and amount. The workflow then processes each row by cleaning the data and assigning a category such as Food, Transport, Subscription, Shopping, Utilities, Health or Other using predefined keyword matching.

Once categorized, it aggregates total spending per category and evaluates whether the spending exceeds a defined budget limit. Based on this evaluation, it generates a detailed, personalized financial advisory report using Google Gemini AI.

Finally, the workflow stores all results in another sheet (Sheet2) and sends an email notification—either a high expense alert or a normal summary—based on the spending status.

Who’s It For

Requirements

To use this workflow, you need:

How To Set Up

1. Import Workflow

Import the provided JSON file into n8n

2. Connect Credentials

3. Prepare Google Sheets

Sheet1 (Input)

DateDescriptionAmount

Sheet2 (Output)

DateCategoryTotal SpentAI ReportStatusReviewed On

4. Configure Settings Node

Update the “Settings — Change These Before Running” node:

5. Run Workflow

How It Works (Step-by-Step Flow)

  1. Manual Trigger

    • Starts the workflow
  2. Read Expenses

    • Fetches rows from Sheet1
  3. Settings Node

    • Stores all configurable values
  4. Clean & Categorize

    • Converts description to lowercase
    • Assigns categories using hardcoded keyword logic
  5. Summarize

    • Groups data by category
    • Calculates total spend
  6. Build AI Fields

    • Prepares structured input for Gemini
  7. Gemini AI

    • Generates detailed financial advisory report
  8. Collect Data

    • Formats data for storage and email
  9. Save to Sheet2

    • Appends results
  10. Condition Check

  1. Email Notifications

How To Customize Nodes

1. Categorization Logic

2. Budget Threshold

3. AI Prompt

4. Email Content

5. Currency & Region

Add-Ons (Enhancements)

Use Case Examples

  1. Monthly Personal Expense Review

    • Automatically analyze and summarize monthly spending
  2. High Spending Alerts

    • Get notified when a category exceeds your budget
  3. Subscription Cost Optimization

    • Identify unnecessary recurring expenses
  4. Family Budget Monitoring

    • Track combined household expenses
  5. Freelancer Expense Tracking

    • Monitor business vs personal expenses

There can be many more variations of this workflow depending on your needs.

Troubleshooting Guide

IssuePossible CauseSolution
No data fetchedIncorrect Sheet ID or tabVerify Sheet1 configuration
Categories not accurateKeyword mismatchUpdate categorization logic
AI report not generatedInvalid Gemini API keyReconnect API credentials
Emails not sentGmail not connectedReauthorize Gmail OAuth
Sheet2 not updatingColumn mismatchEnsure correct headers
Always “Normal Expense”Budget too highAdjust Budget Limit
Missing email recipientEmail not set in SettingsAdd recipient email

Need Help?

If you need help setting up, customizing or extending this workflow, we’re here to support you.

Whether you want:

Reach out to WeblineIndia for expert assistance in building powerful, scalable automation solutions tailored to your needs.

🔗 Nodes Used

Google Sheets, Gmail, Summarize, Google Gemini

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup