This workflow corresponds to n8n.io template #16183 — we link there as the canonical source.
This workflow follows the Agent → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "Gcb0cNU03uh8EumM",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Simulate business decisions from Google Sheets with AI",
"tags": [],
"nodes": [
{
"id": "0c7c269d-42aa-458b-a43a-fd82490a2c3c",
"name": "Sticky Note - Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"width": 960,
"height": 900,
"content": "## AI Business Decision Simulator\n\nSimulate business decisions with AI before executing real workflows. Run \"what-if\" scenarios on pricing, campaigns, or hiring decisions using historical data.\n\n### Who's it for\n\u2022 Business analysts evaluating pricing strategies\n\u2022 Marketing teams planning campaigns before launch\n\u2022 HR/Ops teams assessing hiring decisions\n\u2022 Founders stress-testing business moves\n\n### How it works / What it does\n1. Accepts a what-if scenario via webhook or manual trigger\n2. Loads historical data from Google Sheets\n3. AI analyzes the scenario against past trends\n4. Simulates 3 possible outcomes (optimistic, realistic, pessimistic)\n5. Generates a decision recommendation report\n6. Logs the simulation result back to Google Sheets\n\n### How to set up\n1. Import this workflow\n2. Configure credentials (Google Sheets, OpenAI/Anthropic)\n3. Populate your historical data Google Sheet\n4. Activate the workflow\n\n### Requirements\n\u2022 Google Sheets (historical data + simulation log)\n\u2022 OpenAI / Anthropic / Grok API\n\u2022 n8n instance\n\n### How to customize\n\u2022 Adjust AI prompt for your industry/domain\n\u2022 Change scenario types in the filter node\n\u2022 Modify outcome columns in the Sheet logger\n\u2022 Add Slack/email notification after simulation"
},
"typeVersion": 1
},
{
"id": "4c179fc5-b49c-4bfb-80de-2525005c110c",
"name": "Sticky Note - Trigger",
"type": "n8n-nodes-base.stickyNote",
"position": [
1088,
272
],
"parameters": {
"color": 4,
"width": 780,
"height": 480,
"content": "## 1. Trigger & Scenario Intake"
},
"typeVersion": 1
},
{
"id": "1543cb96-1966-4d5c-9949-b29fca94a6af",
"name": "Sticky Note - Data",
"type": "n8n-nodes-base.stickyNote",
"position": [
1936,
176
],
"parameters": {
"color": 3,
"width": 916,
"height": 620,
"content": "## 2. Historical Data Fetch & Validation"
},
"typeVersion": 1
},
{
"id": "35653b6c-8c8f-403e-bf97-d6fe314aa46d",
"name": "Sticky Note - AI",
"type": "n8n-nodes-base.stickyNote",
"position": [
2960,
224
],
"parameters": {
"color": 4,
"width": 1124,
"height": 600,
"content": "## 3. AI Simulation & Output"
},
"typeVersion": 1
},
{
"id": "9211debb-46f9-4cfc-92c7-cc83ea55fc64",
"name": "Webhook - Scenario Input",
"type": "n8n-nodes-base.webhook",
"position": [
1248,
384
],
"parameters": {
"path": "simulate-business-decision",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 1.1
},
{
"id": "f5e4e82e-c743-4cdf-af15-c95f18f95bd5",
"name": "Schedule - Weekly Simulation",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
1248,
592
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * 1"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "088b7232-87a8-4326-a005-30c568802b43",
"name": "Prepare Scenario Context",
"type": "n8n-nodes-base.set",
"position": [
1488,
480
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"name": "scenarioType",
"type": "string",
"value": "={{ $json.scenarioType || $json.body?.scenarioType || 'pricing' }}"
},
{
"name": "scenarioDescription",
"type": "string",
"value": "={{ $json.scenarioDescription || $json.body?.scenarioDescription || 'Increase product price by 15%' }}"
},
{
"name": "targetMetric",
"type": "string",
"value": "={{ $json.targetMetric || $json.body?.targetMetric || 'revenue' }}"
},
{
"name": "timeHorizon",
"type": "string",
"value": "={{ $json.timeHorizon || $json.body?.timeHorizon || '3 months' }}"
},
{
"name": "simulationId",
"type": "string",
"value": "={{ 'SIM-' + Date.now().toString() }}"
},
{
"name": "requestedAt",
"type": "string",
"value": "={{ new Date().toISOString() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "d1fdd7e7-2ce4-492d-ab31-7356dfaf1633",
"name": "Filter - Valid Scenario Types",
"type": "n8n-nodes-base.filter",
"position": [
1728,
480
],
"parameters": {
"options": {},
"conditions": {
"conditions": [
{
"operator": {
"type": "string",
"operation": "regex"
},
"leftValue": "={{ $json.scenarioType }}",
"rightValue": "^(pricing|campaign|hiring|expansion|discount|budget)$"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "5fd08c46-b963-4af7-b06d-a78df9816a7f",
"name": "Fetch Historical Data",
"type": "n8n-nodes-base.httpRequest",
"position": [
1968,
384
],
"parameters": {
"url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_HISTORICAL_SHEET_ID/values/HistoricalData!A1:Z200?key=YOUR_TOKEN_HERE",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "94543f2e-dc7d-46a8-9712-57ebdbba8f12",
"name": "Python - Parse & Summarize History",
"type": "n8n-nodes-base.code",
"position": [
2208,
480
],
"parameters": {
"mode": "runOnceForEachItem",
"language": "python"
},
"typeVersion": 2
},
{
"id": "4ca97fd1-23ca-4055-a11a-76a618628323",
"name": "JS - Build Prompt Context",
"type": "n8n-nodes-base.code",
"position": [
2512,
480
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const item = $input.item.json;\n\n// Summarize scenario context for AI prompt\nconst historySummary = item.historySummary || 'No historical data available.';\n\nreturn {\n json: {\n ...item,\n promptContext: {\n scenarioType: item.scenarioType,\n scenarioDescription: item.scenarioDescription,\n targetMetric: item.targetMetric,\n timeHorizon: item.timeHorizon,\n historySummary\n }\n }\n};"
},
"typeVersion": 2
},
{
"id": "96870305-1a8b-438c-895d-ab6c7cdfa00d",
"name": "Wait - Rate Limit Buffer",
"type": "n8n-nodes-base.wait",
"position": [
2688,
480
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f60c151c-cf5f-45b2-80d3-9dd3fbc78875",
"name": "AI - Simulate Outcomes",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
3040,
480
],
"parameters": {
"text": "=You are a senior business strategy consultant and data analyst. Simulate the following business decision using the historical performance data provided.\n\n---\n\n### Scenario Details\n- **Type**: {{ $json.scenarioType }}\n- **Decision**: {{ $json.scenarioDescription }}\n- **Target Metric**: {{ $json.targetMetric }}\n- **Time Horizon**: {{ $json.timeHorizon }}\n\n### Historical Data Summary\n{{ $json.historySummary || 'No historical data provided. Use general business benchmarks.' }}\n\n---\n\n### Instructions\nGenerate a structured what-if simulation with exactly 3 outcome scenarios:\n\n1. **Optimistic Outcome** \u2013 Best-case based on historical uptrends\n2. **Realistic Outcome** \u2013 Most probable based on average trends\n3. **Pessimistic Outcome** \u2013 Worst-case based on historical downturns\n\nFor each outcome, provide:\n- Projected change in {{ $json.targetMetric }} (%)\n- Key drivers / assumptions\n- Top 2 risks\n- Confidence score (0\u2013100%)\n\nEnd with a **Recommendation** (2\u20133 sentences) on whether to proceed, delay, or modify the decision.\n\nKeep the total response under 400 words. Use clear headers.",
"options": {},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "4d7910ab-cef1-4439-bbbe-8f3cd4751028",
"name": "JS - Format Simulation Report",
"type": "n8n-nodes-base.code",
"position": [
3328,
480
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const item = $input.item.json;\nconst aiOutput = item.output || item.text || item.response || 'Simulation could not be generated.';\n\n// Extract recommendation snippet (last paragraph heuristic)\nconst lines = aiOutput.split('\\n').filter(l => l.trim());\nconst recommendationLine = lines.find(l => l.toLowerCase().includes('recommendation')) || lines[lines.length - 1];\n\nreturn {\n json: {\n ...item,\n simulationReport: aiOutput,\n recommendationSummary: recommendationLine.replace(/[#*]/g, '').trim(),\n status: 'Simulated',\n completedAt: new Date().toISOString().split('T')[0]\n }\n};"
},
"typeVersion": 2
},
{
"id": "20bae7bb-7b16-49ab-b42e-73a17fc24488",
"name": "Log Simulation to Google Sheet",
"type": "n8n-nodes-base.httpRequest",
"position": [
3568,
384
],
"parameters": {
"url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_LOG_SHEET_ID/values/SimulationLog!A1:append?valueInputOption=USER_ENTERED",
"method": "POST",
"options": {},
"jsonBody": "={\n \"values\": [[\n \"{{ $json.simulationId }}\",\n \"{{ $json.completedAt }}\",\n \"{{ $json.scenarioType }}\",\n \"{{ $json.scenarioDescription }}\",\n \"{{ $json.targetMetric }}\",\n \"{{ $json.timeHorizon }}\",\n \"{{ $json.status }}\",\n \"{{ $json.recommendationSummary }}\"\n ]]\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "b3006ad2-4685-490b-8d84-8ab65a619337",
"name": "Notify via Slack",
"type": "n8n-nodes-base.httpRequest",
"position": [
3568,
592
],
"parameters": {
"url": "https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK_URL",
"method": "POST",
"options": {},
"jsonBody": "={\n \"text\": \"*\ud83d\udcca Business Simulation Complete*\\n*ID:* {{ $json.simulationId }}\\n*Scenario:* {{ $json.scenarioDescription }}\\n*Recommendation:* {{ $json.recommendationSummary }}\\n*View full report in Google Sheets.*\"\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "8b811db0-ae90-4515-a177-c085ff077121",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
3808,
480
],
"parameters": {
"options": {},
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ simulationId: $json.simulationId, status: $json.status, report: $json.simulationReport, recommendation: $json.recommendationSummary }) }}"
},
"typeVersion": 1.1
},
{
"id": "a25ae029-a46d-406a-a2b0-590b3c523c5e",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
3072,
704
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "134a5439-78e9-42b3-b041-40b15fbc2761",
"name": "Wait For Data",
"type": "n8n-nodes-base.wait",
"position": [
2352,
480
],
"parameters": {
"unit": "minutes",
"amount": 1
},
"typeVersion": 1.1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "7a7240e4-25e5-4cad-b35e-b0ebc9068ff4",
"connections": {
"Wait For Data": {
"main": [
[
{
"node": "JS - Build Prompt Context",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI - Simulate Outcomes",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Fetch Historical Data": {
"main": [
[
{
"node": "Python - Parse & Summarize History",
"type": "main",
"index": 0
}
]
]
},
"AI - Simulate Outcomes": {
"main": [
[
{
"node": "JS - Format Simulation Report",
"type": "main",
"index": 0
}
]
]
},
"Prepare Scenario Context": {
"main": [
[
{
"node": "Filter - Valid Scenario Types",
"type": "main",
"index": 0
}
]
]
},
"Wait - Rate Limit Buffer": {
"main": [
[
{
"node": "AI - Simulate Outcomes",
"type": "main",
"index": 0
}
]
]
},
"Webhook - Scenario Input": {
"main": [
[
{
"node": "Prepare Scenario Context",
"type": "main",
"index": 0
}
]
]
},
"JS - Build Prompt Context": {
"main": [
[
{
"node": "Wait - Rate Limit Buffer",
"type": "main",
"index": 0
}
]
]
},
"Schedule - Weekly Simulation": {
"main": [
[
{
"node": "Prepare Scenario Context",
"type": "main",
"index": 0
}
]
]
},
"Filter - Valid Scenario Types": {
"main": [
[
{
"node": "Fetch Historical Data",
"type": "main",
"index": 0
}
]
]
},
"JS - Format Simulation Report": {
"main": [
[
{
"node": "Log Simulation to Google Sheet",
"type": "main",
"index": 0
},
{
"node": "Notify via Slack",
"type": "main",
"index": 0
}
]
]
},
"Log Simulation to Google Sheet": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Python - Parse & Summarize History": {
"main": [
[
{
"node": "Wait For Data",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow simulates business decision scenarios using Google Sheets data and AI analysis, generating what-if reports and recommendations for pricing, campaign, or hiring moves, and logs results to Google Sheets and Slack. Listens for incoming scenario requests via webhook or…
Source: https://n8n.io/workflows/16183/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
⏺ 🚀 How it works
L&D_AgentsAI_ATIVO. Uses httpRequest, agent, googleCalendarTool, toolSerpApi. Webhook trigger; 93 nodes.
CLINICAINTEGRAL_secretary. Uses postgres, mcpClientTool, googleDriveTool, toolWorkflow. Webhook trigger; 89 nodes.
Remi 1.1. Uses lmChatOpenAi, memoryPostgresChat, openAi, postgres. Webhook trigger; 89 nodes.
This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages La