Monitor budget variance with Google Sheets, Gemini, Slack, and Gmail

Go to Workflow
0 views
Built by WeblineIndia WeblineIndia
Created on June 24, 2026

Description

Quick overview
This workflow runs daily to compare department budgets and actual spend from Google Sheets, calculates variance, uses Google Gemini to generate root-cause insights, sends Slack alerts when variance breaches a threshold, logs results back to Google Sheets, and emails a daily report via Gmail.

How it works
Runs every day at 9:00 AM on a schedule.
Reads budget and actual spend data from two Google Sheets tabs and matches records by Department.
Calculates spend variance and variance percentage, then assigns a status label (Healthy/Warning/Critical) and run context like date and summary.
Sends the variance details to Google Gemini to generate a JSON response with root cause, risk level, and recommendations.
Checks whether the variance percentage is greater than 10% and sends a Slack alert with the AI insights when the threshold is exceeded.
Appends the final analysis (including whether an alert was sent) to a Google Sheets log and sends the same report via Gmail.

Setup
Connect Google Sheets OAuth credentials and set the correct spreadsheet and sheet tabs for Budget Data, Actual spend, and the Final report log.
Add a Google Gemini (PaLM) API credential for the Gemini model used in the analysis step.
Add Slack OAuth2 credentials and choose the channel where budget variance alerts should be posted.
Add Gmail OAuth2 credentials and set the recipient(s) for the daily budget monitoring email.
Update the variance alert threshold (currently >10% variance) and status thresholds (10%/20%) to match your policy.

Requirements
n8n instance (self-hosted or cloud)
Google Sheets OAuth2 credentials
Google Gemini (PaLM) API credentials
Slack OAuth2 credentials
Gmail OAuth2 credentials
Properly structured Google Sheets:
Budget Sheet → Department, Budget
Spend Sheet → Department, Spend
Report Sheet → Predefined columns for logging

Customization
Variance Threshold**: Modify IF node condition (> 10) to any value
Update logic in Add Status & Context Details node: Critical: > 20% or Warning: > 10%
Gemini Prompt*: Customize prompt inside *AI-Based Budget Analysis node to get different insights
Slack Message Format**: Modify message body to include/exclude fields
Email Template**: Customize HTML in Gmail node for branding or formatting
Schedule Time**: Change trigger time as per business needs

Additional info
Who’s It For

Finance and accounting teams
Procurement departments
Operations managers
Business analysts
Startups and enterprises managing departmental budgets

Add-ons (Enhancements)

Add monthly or weekly summary reports
Integrate Power BI / dashboards for visualization
Add multi-level approvals for high-risk alerts
Store data in a database (MySQL/PostgreSQL) instead of Sheets
Add SMS or WhatsApp alerts for critical cases
Include historical trend analysis using AI

Use Case Examples

Corporate Budget Monitoring

Track departmental spending daily and prevent overspending

Procurement Cost Control

Identify supplier-related cost deviations early

Startup Financial Discipline

Maintain strict control over limited budgets

Project-Based Budget Tracking

Monitor cost overruns across multiple projects

Audit & Compliance Reporting

Maintain a clear log of financial decisions and anomalies

These are just a few examples—this workflow can be adapted for many other financial monitoring scenarios.

Troubleshooting Guide

| Issue | Possible Cause | Solution |
|------|--------------|---------|
| No data fetched | Incorrect Google Sheets configuration | Verify sheet IDs and column names |
| Merge not working | Department names mismatch | Ensure consistent naming across sheets |
| Wrong variance values | Non-numeric data | Ensure Budget and Spend fields are numbers |
| No Slack alerts | Condition not met or Slack not configured | Check IF condition and Slack credentials |
| AI output missing | Gemini API issue | Verify API credentials and prompt |
| Email not sent | Gmail credentials issue | Reconnect Gmail OAuth |
| Data not logged | Sheet mapping issue | Check column mapping in final node |
| Workflow not running | Trigger inactive | Activate workflow |

Need Help?

If you need help setting up this workflow, customizing it for your business, or adding advanced features like dashboards, AI enhancements or integrations, our n8n workflow development team at WeblineIndia is here to assist you.

We specialize in building scalable automation workflows tailored to your business needs.

Reach out to us for:
Workflow setup & deployment
Custom automation solutions
AI-powered business workflows
Integration with enterprise systems

Let us help you turn automation into a competitive advantage.

Nodes Used (5)

Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Gemini
@n8n/n8n-nodes-langchain.googleGemini
Google Sheets
n8n-nodes-base.googleSheets
Slack
n8n-nodes-base.slack