This workflow corresponds to n8n.io template #6753 — we link there as the canonical source.
This workflow follows the Agent → Google Sheets 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "a241764c-eb51-4d7a-b5d4-3aa517a9195f",
"name": "Google Sheets1",
"type": "n8n-nodes-base.googleSheets",
"position": [
-160,
280
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 173686600,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=173686600",
"cachedResultName": "Sheet2"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=drivesdk",
"cachedResultName": "Sample Marketing Data"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "d7b9ee1a-f87d-42f6-b480-8ee687612f33",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"position": [
340,
120
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "65acf956-5912-4070-8896-923b74548a5e",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.Clicks }}",
"rightValue": 5
}
]
}
},
"typeVersion": 2.2
},
{
"id": "872dd275-ca9a-4d30-8ac1-e1e921f5e6fd",
"name": "Convert table names and columns into single text for agent",
"type": "n8n-nodes-base.code",
"position": [
1380,
280
],
"parameters": {
"jsCode": "return [\n {\n json: {\n text: items.map(item => JSON.stringify(item.json)).join('\\n'),\n },\n },\n];\n"
},
"typeVersion": 2
},
{
"id": "4b8595d1-d975-49f6-bff0-265aef52042f",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1620,
500
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "c83d8a13-b2da-42f5-b137-763fa06e22e4",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1800,
500
],
"parameters": {
"jsonSchemaExample": "{\n\t\"paragraph\": \"full paragraph\"\n}"
},
"typeVersion": 1.2
},
{
"id": "c1ad3e75-1964-4f3b-b60c-a9531f8770f7",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-440,
-200
],
"parameters": {
"width": 700,
"height": 880,
"content": "### \ud83d\udccc Merge Multiple Datasets\n\nPull two Google Sheets:\n\n- **Marketing data** (performance metrics) \n- **Leader assignment** (who manages each channel)\n\nThen merge the two sheets based on the **Channel** field.\n\n---\n"
},
"typeVersion": 1
},
{
"id": "9de427fa-c2e0-4de0-8e7b-35d4566f3d6e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
280,
-200
],
"parameters": {
"color": 5,
"width": 380,
"height": 880,
"content": "\n### \ud83d\udccc Filter and If Steps\n\n**Step 1:** Filter records with **Clicks \u2265 5** \n**Step 2:** Branch logic:\n\n- If **Spend \u2265 350** \u2192 `\"Great\"` outcome \n- Else \u2192 `\"Poor\"` outcome\n\n---"
},
"typeVersion": 1
},
{
"id": "8aa28836-07db-42f7-b2da-0b2e656e92c7",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
-200
],
"parameters": {
"color": 3,
"width": 380,
"height": 880,
"content": "### \ud83d\udccc Summarize and Set Steps\n\nFor each branch (**Great** / **Poor**):\n\n- Count the number of rows per **Leader** \n- Assign outcome labels \n- Prepare fields like `Leader`, `Outcome`, and `Day count`\n\n---"
},
"typeVersion": 1
},
{
"id": "1fb89d3c-a10e-490d-998a-42436a1d05d0",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1100,
-200
],
"parameters": {
"color": 2,
"width": 860,
"height": 880,
"content": "### \ud83d\udccc Analyze Results with an AI Agent\n\n- Merge both sets of labeled outcomes \n- Convert to a readable text format \n- Use an **AI Agent** to summarize and compare performance of leaders \n- Output a **paragraph** that identifies the **best** and **worst** performers and **why**"
},
"typeVersion": 1
},
{
"id": "02854b46-8baf-438e-b110-92ce4e96dd6b",
"name": "Sample Marketing Data",
"type": "n8n-nodes-base.googleSheets",
"position": [
-160,
80
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=drivesdk",
"cachedResultName": "Sample Marketing Data"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "cf5b6397-fe1a-46db-928a-5903507ef424",
"name": "Start Workflow",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-380,
180
],
"parameters": {},
"typeVersion": 1
},
{
"id": "58039c62-8b23-4114-9e86-5502c82719ee",
"name": "Merge on Channel Field",
"type": "n8n-nodes-base.merge",
"position": [
60,
180
],
"parameters": {
"mode": "combine",
"options": {},
"fieldsToMatchString": "Channel"
},
"typeVersion": 3.2
},
{
"id": "7ed757ca-05b7-41af-9f70-f88b9aba4981",
"name": "Check if spend over $350",
"type": "n8n-nodes-base.if",
"position": [
460,
340
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c0cba05b-63ba-420e-851a-caf2bf9b9914",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json['Spend ($)'] }}",
"rightValue": 350
}
]
}
},
"typeVersion": 2.2
},
{
"id": "73aeb996-58d7-4492-a948-bc6f9f92cb46",
"name": "Count bad days",
"type": "n8n-nodes-base.summarize",
"position": [
740,
100
],
"parameters": {
"options": {},
"fieldsToSplitBy": "Leader",
"fieldsToSummarize": {
"values": [
{
"field": "row_number"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "af21446e-d779-4937-bee4-d650dccd8f32",
"name": "Count good days",
"type": "n8n-nodes-base.summarize",
"position": [
760,
300
],
"parameters": {
"options": {},
"fieldsToSplitBy": "Leader",
"fieldsToSummarize": {
"values": [
{
"field": "row_number"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "9b6bb3eb-aae2-4317-8551-78fb81312765",
"name": "Organize fields into table",
"type": "n8n-nodes-base.set",
"position": [
920,
120
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e2f52c05-13a5-4692-bbea-87642535145e",
"name": "Outcome",
"type": "string",
"value": "Poor"
},
{
"id": "8c353e0a-409f-4cff-a1b9-17259cc3a1dd",
"name": "# of Days",
"type": "number",
"value": "={{ $json.count_row_number }}"
},
{
"id": "82d2f8dd-54b8-42c8-b502-6ae1fc76e1fe",
"name": "Leader",
"type": "string",
"value": "={{ $json.Leader }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b5780191-2068-4595-b18c-16626003145d",
"name": "Organize second data into table",
"type": "n8n-nodes-base.set",
"position": [
920,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f3f79a06-acb9-4b89-a7ab-438358b4395e",
"name": "Outcome",
"type": "string",
"value": "Great"
},
{
"id": "e79913fa-a2ec-459c-a00d-df23bb1a2a25",
"name": "# of Days",
"type": "number",
"value": "={{ $json.count_row_number }}"
},
{
"id": "a6b563e3-0776-4916-a9f3-05d38a67330a",
"name": "Leader",
"type": "string",
"value": "={{ $json.Leader }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "097dc227-3999-427c-9900-008845b00131",
"name": "Append datasources together",
"type": "n8n-nodes-base.merge",
"position": [
1180,
220
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "1ec5183b-be3f-447a-b312-56420ac5c706",
"name": "AI Agent - Summarize Leader Performance",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1600,
180
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "You are given a list of outcomes by leader. write a summary of the outcomes and identify who is doing the best and worst, and why. \n\noutput as one paragraph. \n\nOutput like this. \n\n{\n\t\"paragraph\": \"full paragraph\"\n}"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2
},
{
"id": "0a53ca1a-53f0-4d68-b70f-e5fff251af5f",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-440,
-400
],
"parameters": {
"color": 4,
"width": 1100,
"content": "### \ud83d\udccc Setup Instructions\n\nBefore running the workflow:\n\n1. **Copy the sample Google Sheet** \n [Click here to copy the Google Sheet](https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/copy)\n\n2. **Connect Google Sheets API** \n - In n8n, go to **Credentials** and create a **Google Sheets OAuth2** credential.\n - Make sure to authorize access to the copied spreadsheet.\n\n3. **Add your OpenAI API Key** \n - In the **AI Agent** step, connect your **OpenAI credential** using your API key.\n\n---"
},
"typeVersion": 1
},
{
"id": "4dffd2eb-9a06-4103-97a5-47aeccdca95c",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
-400
],
"parameters": {
"color": 2,
"width": 1280,
"content": "### \ud83d\udc4b Questions or Feedback?\nFeel free to reach out \u2014 I\u2019m happy to help!\n**Robert Breen** \nFounder, Ynteractive \n\ud83c\udf10 [ynteractive.com](https://ynteractive.com) \n\ud83d\udce7 robert@ynteractive.com \n\ud83d\udd17 [LinkedIn: linkedin.com/in/robertbreen](https://www.linkedin.com/in/robertbreen)"
},
"typeVersion": 1
}
],
"connections": {
"Filter": {
"main": [
[
{
"node": "Check if spend over $350",
"type": "main",
"index": 0
}
]
]
},
"Count bad days": {
"main": [
[
{
"node": "Organize fields into table",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets1": {
"main": [
[
{
"node": "Merge on Channel Field",
"type": "main",
"index": 1
}
]
]
},
"Start Workflow": {
"main": [
[
{
"node": "Sample Marketing Data",
"type": "main",
"index": 0
},
{
"node": "Google Sheets1",
"type": "main",
"index": 0
}
]
]
},
"Count good days": {
"main": [
[
{
"node": "Organize second data into table",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent - Summarize Leader Performance",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Sample Marketing Data": {
"main": [
[
{
"node": "Merge on Channel Field",
"type": "main",
"index": 0
}
]
]
},
"Merge on Channel Field": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
},
"Check if spend over $350": {
"main": [
[
{
"node": "Count bad days",
"type": "main",
"index": 0
}
],
[
{
"node": "Count good days",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent - Summarize Leader Performance",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Organize fields into table": {
"main": [
[
{
"node": "Append datasources together",
"type": "main",
"index": 0
}
]
]
},
"Append datasources together": {
"main": [
[
{
"node": "Convert table names and columns into single text for agent",
"type": "main",
"index": 0
}
]
]
},
"Organize second data into table": {
"main": [
[
{
"node": "Append datasources together",
"type": "main",
"index": 1
}
]
]
},
"AI Agent - Summarize Leader Performance": {
"main": [
[]
]
},
"Convert table names and columns into single text for agent": {
"main": [
[
{
"node": "AI Agent - Summarize Leader Performance",
"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.
googleSheetsOAuth2ApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This beginner-friendly n8n workflow teaches essential data manipulation techniques using Google Sheets and AI. You'll learn how to: ✅ Merge two datasets by a shared column () 🔍 Filter rows based on performance metrics (, ) 🔀 Branch logic into vs. outcomes 📊 Summarize results by…
Source: https://n8n.io/workflows/6753/ — 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.
🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste
Digistars - Scrape & Crawl. Uses httpRequest, n8n-nodes-firecrawl-scraper, googleSheets, lmChatOpenAi. Event-driven trigger; 63 nodes.
This comprehensive n8n workflow automates the entire Meta (Facebook/Instagram) advertising process, from asset analysis to ad creation. It combines AI-powered content analysis with automated ad deploy