Automated workflow · n8n + Claude + Google Sheets

Budget Variance & Forecast — Google Sheets

The other demos in this portfolio return their result in a webhook response. This one writes it back into a real system of record: a new row in a Google Sheet triggers the workflow, Claude scores and explains the variance, and the analysis lands in a Variance Report tab in the same spreadsheet — no copy-pasting a JSON response anywhere.

4
alert
2
watch
2
ok

Deterministic math, then Claude's judgment

The variance percentage and severity aren't left to the model to compute — a code node calculates them first from whatever Budgeted/Actual values are on the row. Claude never sees a blank slate; it explains, recommends, and drafts, but it doesn't do the arithmetic.

Ok · <5%
Watch · 5–15%
Alert · >15%
Ok
Actual is within 5% of budget in either direction — normal noise, nothing to review.
Watch
5–15% variance — worth a note to the owner, not worth an alarm.
Alert
Over 15% variance — needs an explanation and, if it's an overage, a corrective plan.
Computed deterministically (code node)
Variance $ and %, direction, and severity tier — same inputs always produce the same numbers, no LLM variance on the math.
Judged by Claude
Why the variance likely happened (grounded in the owner's notes column when filled in), what to do about it, and a message toned to the severity — urgent for alert, a heads-up for watch, a quiet FYI for ok.

How a row moves through it

A row lands in the sheet, gets scored and explained, then fans out to two places at once: every row writes back into the Variance Report tab, and alert-tier rows also get tagged for a Slack/email push.

01 · trigger
Budget Sheet Trigger
Polls the Budget Input tab and fires on every new row — Department, Category, Budgeted, Actual, Owner, Notes.
02 · normalize
Normalize Row
Cleans the row's fields and coerces Budgeted/Actual to numbers.
03 · deterministic
Compute Variance & Severity
A code node computes variance $/%, direction, and severity — no LLM involved yet.
Analyze Variance & Draft
Claude explains the likely driver, recommends an action, and drafts the severity-toned message — all in one call.
every row, unconditionally
Write Variance Report Row
Upserts into the Variance Report tab, matched on Department + Category.
if severity = alert
Tag Alert for Slack
Marks the row for the on-call Slack/email push.
otherwise
Tag No Notification
Watch and ok rows are written to the sheet only — no push.

Eight real rows, analyzed live

This is genuinely live: the rows below were typed straight into the connected Google Sheet, picked up by the Sheets Trigger polling that sheet, and written back into the Variance Report tab by the workflow — no pinned test data, no simulated I/O. The variance math is deterministic; the explanations, recommendations, and drafted messages are unscripted Claude output.

Contractor Design Work
Design · owner: Priya Shah
Alert
Budget vs. actual
Budgeted: $14,000
Actual: $19,800
Variance
+$5,800 +41.43%
Explanation
Tied directly to the owner's note about bringing in a freelancer for a rebrand sprint — the original budget likely didn't account for the full cost of the engagement, or the scope expanded after the budget was set.
Notify Draft · written to sheet, tagged for Slack/email
Alert → Priya Shahauto-drafted
Hi Priya — flagging an alert on the Design > Contractor Design Work line for this period. Actual spend came in at $19,800 against a $14,000 budget, a $5,800 overage (41.43% over). I can see from your notes that a freelancer was brought in for the rebrand sprint — thanks for the context. To close this out, could you share: (1) the freelancer's rate and total contracted scope, (2) whether the engagement is now complete or if additional spend is expected, and (3) whether you anticipate needing a budget amendment?
User Research Tools
Product · owner: Devon Clarke
Watch
Budget vs. actual
Budgeted: $8,000
Actual: $7,200
Variance
−$800 −10%
Explanation
The underspend is directly attributable to the mid-quarter cancellation of one vendor subscription, per the owner's notes — favorable on its face, but worth confirming whether the cut is permanent or a replacement tool is coming.
Notify Draft · written to sheet only, no Slack push
Heads-up → Devon Clarkeauto-drafted
Hey Devon — quick heads-up on the User Research Tools budget for this quarter. You're currently $800 under budget (10% favorable), and your note about the mid-quarter vendor cancellation explains the variance. No immediate action needed, but was this cancellation permanent, or is a replacement tool expected later in the year?
Audit & Compliance
Finance · owner: Lena Kowalski
Ok
Budget vs. actual
Budgeted: $25,000
Actual: $25,000
Variance
$0 0%
Explanation
Landed exactly at budget, consistent with the owner's note that everything was on track — typical of the fixed, contract-driven nature of audit and compliance costs.
Notify Draft · written to sheet only, no Slack push
FYI → Lena Kowalskiauto-drafted
Hi Lena — just a quick FYI that your Audit & Compliance line item is perfectly on track this period: $25,000 actuals against a $25,000 budget, a $0 / 0% variance. Nothing needed from you — just wanted to confirm the numbers look great.

Every row gets written back, not just the overages

The same Claude call that explains the variance also drafts what happens next, toned to severity. Every row — alert, watch, or ok — gets a row in the Variance Report tab; only alert-tier rows also get tagged for a live Slack/email push, so the notification volume tracks what actually needs a person's attention.

Why a Google Sheet instead of a Data Table? Every other demo in this portfolio archives to an n8n Data Table — fast to set up, but only visible inside n8n. This one writes into the same spreadsheet finance already has open, so the variance report is something a non-technical stakeholder can open, filter, and share without ever touching n8n.
Department Category Variance % Severity Explanation
Marketing Promotional Campaigns +100% alert Doubled customer acquisitions scaled rewards/incentives spend proportionally.
Design Contractor Design Work +41.43% alert Freelancer brought in for a rebrand sprint, likely under-scoped at budget time.
Operations Field Marketing Events +30% alert Extra regional event added mid-period, per owner's notes.
IT Software Licensing +20% alert New-hire seat licenses plus an unplanned, unbudgeted security tool.
Legal Outside Counsel Contracts −10.56% watch Fewer contract reviews than planned — a demand-side underspend to keep an eye on.
Product User Research Tools −10% watch Mid-quarter vendor subscription cancellation; permanence unconfirmed.
Customer Success Onboarding Events +4% ok One extra virtual onboarding session — minor, well-explained overage.
Finance Audit & Compliance 0% ok Landed exactly on budget, as expected for fixed compliance costs.

Setup: how this is wired

This is a live, authorized connection to a real Google Sheet — not a simulated credential. Here's what's actually configured, for anyone wiring up their own copy.

Going live: what's left beyond this demo

Unlike the webhook-based demos in this portfolio, the write-back here is already the real system of record, and the trigger and credential are already live — there's no "going live" migration left for storage or auth. What's left is entirely about closing the loop on notifications.

already live
Trigger + write-back
The Google Sheets Trigger and the Variance Report write-back run against a real, authorized spreadsheet — not simulated I/O. This is the actual production path.
unchanged from this demo
This variance pipeline
Same compute → analyze → draft sequence shown above, already running on real rows, not pinned test data.
human in the loop
Real Slack/email for alerts
"Ok" and "watch" rows write silently, as they do today. "Alert" rows are tagged for a Slack/email push but not yet wired to a live send — the same intentional scope boundary as the rest of this portfolio.

Why not just use a spreadsheet formula for this?

A conditional-formatting rule or an IF formula can flag a variance percentage in seconds, and at a company with a lightly-used budget sheet, that's genuinely enough — this workflow isn't a replacement for a formula that already does the job.

Where this earns its place: a formula can color a cell red, but it can't read the Notes column and tell you why the number moved, it can't distinguish a one-time spend decision from a structural cost increase, and it can't draft the actual message to the owner in a tone matched to how serious the variance is. This build is the shape you reach for when the sheet you already use needs a layer of judgment and drafting on top — without migrating off it.