Analyze weekly KPI drops with Google Sheets, Gmail, and GPT-4o-mini
Needs changesWhat this workflow does
This AI workflow has 11 nodes and runs on a schedule (cron 0 9 * * 1). Along the way it connects Google Sheets, OpenAI Chat Model and Gmail.
How it runs
Trigger: On a schedule (cron 0 9 * * 1).
- Set config (Edit Fields (Set)): sets 7 fields: sheetId, sheetName, alertEmail…
- Read the KPI log (Google Sheets): get many
- Compare the last two weeks (Code): runs custom JavaScript code
- Anything dropped? (If): checks a condition and branches into true / false
- Explain the drops (AI Agent): runs an AI agent, with model: Chat model; output parser: Output Parser - Analysis
- All healthy, no email (Edit Fields (Set)): sets 1 field: result
- Build the alert email (Code): runs custom JavaScript code
- Send the alert (Gmail): uses Gmail
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other OpenAI + Google Sheets templates (2,011) · Other OpenAI + Gmail templates (1,623)
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in Explain the drops (v1.7): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
Published 2026 — 6% of 2026 templates need changes for 3.0. See how template age affects 3.0 readiness →
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) Explain the drops (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (9)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow checks up to three service URLs every 30 minutes, logs each result to Google Sheets, and sends Gmail alerts only when a service transitions between UP and DOWN. How it works 1. Runs every 30 minutes on a schedule. 2. Builds a…