使用Gemini AI进行自然语言Google Sheets数据分析
高级
这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 22 个节点。主要使用 Switch, Aggregate, Summarize, GoogleSheets, Agent 等节点。 使用Gemini AI进行自然语言Google Sheets数据分析
前置要求
- •Google Sheets API 凭证
- •Google Gemini API Key
使用的节点 (22)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "e1a46833-62a4-49ff-84c6-bdb1fc727d30",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1696,
-176
],
"parameters": {
"width": 736,
"height": 96,
"content": "## 📬 需要帮助或想要自定义?"
},
"typeVersion": 1
},
{
"id": "a1988728-13a9-43f3-bffa-214a242eaf57",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-544,
224
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "Mhhn3j8lRxEgMtc5",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "57a8f11e-4e9a-4899-88a7-c82cbbde49dd",
"name": "获取列信息",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
-320,
640
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 467321788,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=467321788",
"cachedResultName": "Columns"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=drivesdk",
"cachedResultName": "Sample Marketing Data"
},
"descriptionType": "manual",
"toolDescription": "Extracts a sheet’s column metadata so downstream steps (querying, validation, docs) can rely on a clean, typed schema. It returns each column’s name, inferred data type, and human-readable description, plus helpful profiling hints."
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "HlBW2puZbuCCq8jJ",
"name": "Google Sheets account 3"
}
},
"typeVersion": 4.7
},
{
"id": "42696475-5531-423c-b5b1-ef07f232dabd",
"name": "当由其他工作流执行时",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
144,
336
],
"parameters": {
"inputSource": "passthrough"
},
"typeVersion": 1.1
},
{
"id": "a224c359-aa48-4bd3-aff8-057ba8e7d448",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-128,
640
],
"parameters": {
"jsonSchemaExample": "{\n\t\"column\": \"customer\",\n\t\"aggregation\": \"sum\", \n\t\"level\": \"date, channel\"\n}\n"
},
"typeVersion": 1.3
},
{
"id": "fb666df2-8966-406c-a9be-cc6d9929b4c3",
"name": "Google Gemini Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1648,
576
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "Mhhn3j8lRxEgMtc5",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "75d28c95-61e6-4628-b447-2cce457a4a08",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-368,
304
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "0b30c4bc-8078-452c-a4e2-1c398a7a1eb0",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1696,
-48
],
"parameters": {
"width": 736,
"height": 1088,
"content": "## 📊 仅聚合透视问题 — 每次一个指标"
},
"typeVersion": 1
},
{
"id": "0d92421a-7a7b-47d2-a302-1e50a60a147c",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
96,
-160
],
"parameters": {
"color": 4,
"width": 1952,
"height": 1200,
"content": "## ⚙️ 子工作流 - 数据处理器"
},
"typeVersion": 1
},
{
"id": "70c73294-f496-41a1-9e61-ebadece9ee9b",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-928,
-176
],
"parameters": {
"color": 3,
"width": 976,
"height": 1216,
"content": "## 📋 主工作流 - 查询解析器"
},
"typeVersion": 1
},
{
"id": "5445ff22-cd04-4811-91ea-1ac9d0394726",
"name": "使用 Gemini 与数据对话",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-368,
64
],
"parameters": {
"options": {
"systemMessage": "# MVP System Prompt — Google Sheets Ask-Data\n\nRule, you must always use the column tool for every question and followup question to know the column names\n\nif a user asks for multiple metrics, just do the first one\n\nYou are Ask-Data. Answer questions using Google Sheets ONLY via the tools below. Be precise and conservative.\n\nThere is only one dataset. dont ask what dataset it is. \nalways reference the column names tool before going to the data tool. \n\n\nOutput the data as which column is supposed to be analyzed and what is the aggregation. aggregations can only be sum, avg, count, countd, max, min. \n\nthe column needs to be written exactly as the column name is from the other tool. \n\noutput one more column for level of detail comma separated. If its a total aggregate, output \"All\" for level of detail. \n\n\noutput 4 more columns \n\n\n\n{\n\t\"column\": \"customer\",\n\t\"aggregation\": \"sum\", \n\t\"level\": \"date, channel\"\n}\n\n"
},
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "0ef3d740-e2c9-4c95-89bc-2fd66811caa9",
"name": "执行工作流 - 汇总数据",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
-80,
272
],
"parameters": {
"source": "parameter",
"options": {},
"workflowJson": "{\n \"nodes\": [\n {\n \"parameters\": {\n \"inputSource\": \"passthrough\"\n },\n \"type\": \"n8n-nodes-base.executeWorkflowTrigger\",\n \"typeVersion\": 1.1,\n \"position\": [\n 16,\n 496\n ],\n \"id\": \"42696475-5531-423c-b5b1-ef07f232dabd\",\n \"name\": \"When Executed by Another Workflow\"\n },\n {\n \"parameters\": {\n \"documentId\": {\n \"__rl\": true,\n \"value\": \"19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA\",\n \"mode\": \"list\",\n \"cachedResultName\": \"Sample Marketing Data\",\n \"cachedResultUrl\": \"https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=drivesdk\"\n },\n \"sheetName\": {\n \"__rl\": true,\n \"value\": 365710158,\n \"mode\": \"list\",\n \"cachedResultName\": \"Data\",\n \"cachedResultUrl\": \"https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=365710158\"\n },\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.googleSheets\",\n \"typeVersion\": 4.7,\n \"position\": [\n 592,\n 496\n ],\n \"id\": \"c8f62b21-0027-4aa0-b6e0-d33025a8719f\",\n \"name\": \"Get row(s) in sheet\",\n \"credentials\": {\n \"googleSheetsOAuth2Api\": {\n \"id\": \"HlBW2puZbuCCq8jJ\",\n \"name\": \"Google Sheets account 3\"\n }\n }\n },\n {\n \"parameters\": {\n \"fieldsToSummarize\": {\n \"values\": [\n {\n \"aggregation\": \"countUnique\",\n \"field\": \"={{ $('When Executed by Another Workflow').item.json.output.column }}\"\n }\n ]\n },\n \"fieldsToSplitBy\": \"={{ $('When Executed by Another Workflow').item.json.output.level }}\",\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.summarize\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1120,\n 160\n ],\n \"id\": \"3a9774c9-e95c-4dc9-9812-120907a2176a\",\n \"name\": \"Summarize\"\n },\n {\n \"parameters\": {\n \"rules\": {\n \"values\": [\n {\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": true,\n \"leftValue\": \"\",\n \"typeValidation\": \"strict\",\n \"version\": 2\n },\n \"conditions\": [\n {\n \"leftValue\": \"={{ $('When Executed by Another Workflow').item.json.output.aggregation }}\",\n \"rightValue\": \"countd\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\"\n },\n \"id\": \"297ff075-7abd-4343-8bc7-0c847c9f709a\"\n }\n ],\n \"combinator\": \"and\"\n },\n \"renameOutput\": true,\n \"outputKey\": \"countd\"\n },\n {\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": true,\n \"leftValue\": \"\",\n \"typeValidation\": \"strict\",\n \"version\": 2\n },\n \"conditions\": [\n {\n \"id\": \"9845fa13-3f60-459c-8265-17031d741464\",\n \"leftValue\": \"={{ $('When Executed by Another Workflow').item.json.output.aggregation }}\",\n \"rightValue\": \"sum\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\",\n \"name\": \"filter.operator.equals\"\n }\n }\n ],\n \"combinator\": \"and\"\n },\n \"renameOutput\": true,\n \"outputKey\": \"sum\"\n },\n {\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": true,\n \"leftValue\": \"\",\n \"typeValidation\": \"strict\",\n \"version\": 2\n },\n \"conditions\": [\n {\n \"id\": \"0b51e6c0-9734-4db8-a5ed-6f0fd102f03f\",\n \"leftValue\": \"={{ $('When Executed by Another Workflow').item.json.output.aggregation }}\",\n \"rightValue\": \"avg\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\",\n \"name\": \"filter.operator.equals\"\n }\n }\n ],\n \"combinator\": \"and\"\n },\n \"renameOutput\": true,\n \"outputKey\": \"avg\"\n },\n {\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": true,\n \"leftValue\": \"\",\n \"typeValidation\": \"strict\",\n \"version\": 2\n },\n \"conditions\": [\n {\n \"id\": \"cea94521-373b-4c86-97a9-293c8c27a307\",\n \"leftValue\": \"={{ $('When Executed by Another Workflow').item.json.output.aggregation }}\",\n \"rightValue\": \"min\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\",\n \"name\": \"filter.operator.equals\"\n }\n }\n ],\n \"combinator\": \"and\"\n },\n \"renameOutput\": true,\n \"outputKey\": \"min\"\n },\n {\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": true,\n \"leftValue\": \"\",\n \"typeValidation\": \"strict\",\n \"version\": 2\n },\n \"conditions\": [\n {\n \"id\": \"4dd86101-6290-4c33-aa4d-f7a9acfc97f8\",\n \"leftValue\": \"={{ $('When Executed by Another Workflow').item.json.output.aggregation }}\",\n \"rightValue\": \"max\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\",\n \"name\": \"filter.operator.equals\"\n }\n }\n ],\n \"combinator\": \"and\"\n },\n \"renameOutput\": true,\n \"outputKey\": \"max\"\n },\n {\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": true,\n \"leftValue\": \"\",\n \"typeValidation\": \"strict\",\n \"version\": 2\n },\n \"conditions\": [\n {\n \"id\": \"8707085d-91b4-4016-8e30-f8574354f020\",\n \"leftValue\": \"={{ $('When Executed by Another Workflow').item.json.output.aggregation }}\",\n \"rightValue\": \"count\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\",\n \"name\": \"filter.operator.equals\"\n }\n }\n ],\n \"combinator\": \"and\"\n },\n \"renameOutput\": true,\n \"outputKey\": \"count\"\n }\n ]\n },\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.switch\",\n \"typeVersion\": 3.2,\n \"position\": [\n 816,\n 496\n ],\n \"id\": \"81b3dbc8-d49b-4ab3-aaa3-b1fdbced4723\",\n \"name\": \"Switch\"\n },\n {\n \"parameters\": {\n \"fieldsToSummarize\": {\n \"values\": [\n {\n \"aggregation\": \"sum\",\n \"field\": \"={{ $('When Executed by Another Workflow').item.json.output.column }}\"\n }\n ]\n },\n \"fieldsToSplitBy\": \"={{ $('When Executed by Another Workflow').item.json.output.level }}\",\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.summarize\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1136,\n 336\n ],\n \"id\": \"b33509be-33f9-43ec-b59c-b021885a9091\",\n \"name\": \"Summarize1\"\n },\n {\n \"parameters\": {\n \"fieldsToSummarize\": {\n \"values\": [\n {\n \"aggregation\": \"average\",\n \"field\": \"={{ $('When Executed by Another Workflow').item.json.output.column }}\"\n }\n ]\n },\n \"fieldsToSplitBy\": \"={{ $('When Executed by Another Workflow').item.json.output.level }}\",\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.summarize\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1152,\n 480\n ],\n \"id\": \"8a272c6f-0844-47bc-bb3a-b3fcb6e0736c\",\n \"name\": \"Summarize2\"\n },\n {\n \"parameters\": {\n \"fieldsToSummarize\": {\n \"values\": [\n {\n \"aggregation\": \"min\",\n \"field\": \"={{ $('When Executed by Another Workflow').item.json.output.column }}\"\n }\n ]\n },\n \"fieldsToSplitBy\": \"={{ $('When Executed by Another Workflow').item.json.output.level }}\",\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.summarize\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1168,\n 656\n ],\n \"id\": \"1b2b472d-e080-4202-aba8-2edda368c991\",\n \"name\": \"Summarize3\"\n },\n {\n \"parameters\": {\n \"fieldsToSummarize\": {\n \"values\": [\n {\n \"aggregation\": \"max\",\n \"field\": \"={{ $('When Executed by Another Workflow').item.json.output.column }}\"\n }\n ]\n },\n \"fieldsToSplitBy\": \"={{ $('When Executed by Another Workflow').item.json.output.level }}\",\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.summarize\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1200,\n 816\n ],\n \"id\": \"cf32aa9a-79fa-4aa9-bb78-e24fb06ea9eb\",\n \"name\": \"Summarize4\"\n },\n {\n \"parameters\": {\n \"fieldsToSummarize\": {\n \"values\": [\n {\n \"field\": \"={{ $('When Executed by Another Workflow').item.json.output.column }}\"\n }\n ]\n },\n \"fieldsToSplitBy\": \"={{ $('When Executed by Another Workflow').item.json.output.level }}\",\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.summarize\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1216,\n 976\n ],\n \"id\": \"eaafbe35-02f0-4bfe-9659-d7db0348fcdc\",\n \"name\": \"Summarize5\"\n },\n {\n \"parameters\": {\n \"aggregate\": \"aggregateAllItemData\",\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.aggregate\",\n \"typeVersion\": 1,\n \"position\": [\n 1504,\n 528\n ],\n \"id\": \"93897c1f-9403-4146-973e-3dd0febc61c4\",\n \"name\": \"Aggregate\"\n },\n {\n \"parameters\": {\n \"promptType\": \"define\",\n \"text\": \"={{ $json.data }}\",\n \"options\": {\n \"systemMessage\": \"write this into one table\"\n }\n },\n \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n \"typeVersion\": 2.2,\n \"position\": [\n 1760,\n 512\n ],\n \"id\": \"6f061b81-725d-4202-a22b-15458a7ae8a0\",\n \"name\": \"AI Agent1\"\n },\n {\n \"parameters\": {\n \"options\": {}\n },\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatGoogleGemini\",\n \"typeVersion\": 1,\n \"position\": [\n 1824,\n 704\n ],\n \"id\": \"fb666df2-8966-406c-a9be-cc6d9929b4c3\",\n \"name\": \"Google Gemini Chat Model1\",\n \"credentials\": {\n \"googlePalmApi\": {\n \"id\": \"Mhhn3j8lRxEgMtc5\",\n \"name\": \"Google Gemini(PaLM) Api account\"\n }\n }\n }\n ],\n \"connections\": {\n \"When Executed by Another Workflow\": {\n \"main\": [\n [\n {\n \"node\": \"Get row(s) in sheet\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get row(s) in sheet\": {\n \"main\": [\n [\n {\n \"node\": \"Switch\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Summarize\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Switch\": {\n \"main\": [\n [\n {\n \"node\": \"Summarize\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Summarize1\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Summarize2\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Summarize3\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Summarize4\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Summarize5\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Summarize1\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Summarize2\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Summarize3\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Summarize4\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Summarize5\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Aggregate\": {\n \"main\": [\n [\n {\n \"node\": \"AI Agent1\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Google Gemini Chat Model1\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"AI Agent1\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n }\n },\n \"pinData\": {\n \"When Executed by Another Workflow\": [\n {\n \"output\": {\n \"column\": \"Spend ($)\",\n \"aggregation\": \"sum\",\n \"level\": \"Channel\"\n }\n }\n ]\n },\n \"meta\": {\n \"templateCredsSetupCompleted\": true,\n \"instanceId\": \"ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9\"\n }\n}"
},
"typeVersion": 1.2
},
{
"id": "c8f62b21-0027-4aa0-b6e0-d33025a8719f",
"name": "获取数据",
"type": "n8n-nodes-base.googleSheets",
"position": [
448,
336
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 365710158,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=365710158",
"cachedResultName": "Data"
},
"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": {
"id": "HlBW2puZbuCCq8jJ",
"name": "Google Sheets account 3"
}
},
"typeVersion": 4.7
},
{
"id": "81b3dbc8-d49b-4ab3-aaa3-b1fdbced4723",
"name": "聚合类型",
"type": "n8n-nodes-base.switch",
"position": [
704,
336
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "countd",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "297ff075-7abd-4343-8bc7-0c847c9f709a",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('When Executed by Another Workflow').item.json.output.aggregation }}",
"rightValue": "countd"
}
]
},
"renameOutput": true
},
{
"outputKey": "sum",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9845fa13-3f60-459c-8265-17031d741464",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('When Executed by Another Workflow').item.json.output.aggregation }}",
"rightValue": "sum"
}
]
},
"renameOutput": true
},
{
"outputKey": "avg",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0b51e6c0-9734-4db8-a5ed-6f0fd102f03f",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('When Executed by Another Workflow').item.json.output.aggregation }}",
"rightValue": "avg"
}
]
},
"renameOutput": true
},
{
"outputKey": "min",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cea94521-373b-4c86-97a9-293c8c27a307",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('When Executed by Another Workflow').item.json.output.aggregation }}",
"rightValue": "min"
}
]
},
"renameOutput": true
},
{
"outputKey": "max",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4dd86101-6290-4c33-aa4d-f7a9acfc97f8",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('When Executed by Another Workflow').item.json.output.aggregation }}",
"rightValue": "max"
}
]
},
"renameOutput": true
},
{
"outputKey": "count",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8707085d-91b4-4016-8e30-f8574354f020",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('When Executed by Another Workflow').item.json.output.aggregation }}",
"rightValue": "count"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "93897c1f-9403-4146-973e-3dd0febc61c4",
"name": "汇总所有数据",
"type": "n8n-nodes-base.aggregate",
"position": [
1392,
368
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "3a9774c9-e95c-4dc9-9812-120907a2176a",
"name": "计数唯一值",
"type": "n8n-nodes-base.summarize",
"position": [
992,
-96
],
"parameters": {
"options": {},
"fieldsToSplitBy": "={{ $('When Executed by Another Workflow').item.json.output.level }}",
"fieldsToSummarize": {
"values": [
{
"field": "={{ $('When Executed by Another Workflow').item.json.output.column }}",
"aggregation": "countUnique"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "b33509be-33f9-43ec-b59c-b021885a9091",
"name": "求和",
"type": "n8n-nodes-base.summarize",
"position": [
1024,
64
],
"parameters": {
"options": {},
"fieldsToSplitBy": "={{ $('When Executed by Another Workflow').item.json.output.level }}",
"fieldsToSummarize": {
"values": [
{
"field": "={{ $('When Executed by Another Workflow').item.json.output.column }}",
"aggregation": "sum"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "8a272c6f-0844-47bc-bb3a-b3fcb6e0736c",
"name": "平均值",
"type": "n8n-nodes-base.summarize",
"position": [
1040,
192
],
"parameters": {
"options": {},
"fieldsToSplitBy": "={{ $('When Executed by Another Workflow').item.json.output.level }}",
"fieldsToSummarize": {
"values": [
{
"field": "={{ $('When Executed by Another Workflow').item.json.output.column }}",
"aggregation": "average"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "1b2b472d-e080-4202-aba8-2edda368c991",
"name": "最小值",
"type": "n8n-nodes-base.summarize",
"position": [
1040,
368
],
"parameters": {
"options": {},
"fieldsToSplitBy": "={{ $('When Executed by Another Workflow').item.json.output.level }}",
"fieldsToSummarize": {
"values": [
{
"field": "={{ $('When Executed by Another Workflow').item.json.output.column }}",
"aggregation": "min"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "cf32aa9a-79fa-4aa9-bb78-e24fb06ea9eb",
"name": "最大值",
"type": "n8n-nodes-base.summarize",
"position": [
1056,
544
],
"parameters": {
"options": {},
"fieldsToSplitBy": "={{ $('When Executed by Another Workflow').item.json.output.level }}",
"fieldsToSummarize": {
"values": [
{
"field": "={{ $('When Executed by Another Workflow').item.json.output.column }}",
"aggregation": "max"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "eaafbe35-02f0-4bfe-9659-d7db0348fcdc",
"name": "计数",
"type": "n8n-nodes-base.summarize",
"position": [
1056,
688
],
"parameters": {
"options": {},
"fieldsToSplitBy": "={{ $('When Executed by Another Workflow').item.json.output.level }}",
"fieldsToSummarize": {
"values": [
{
"field": "={{ $('When Executed by Another Workflow').item.json.output.column }}"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "6f061b81-725d-4202-a22b-15458a7ae8a0",
"name": "写入表格输出",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1648,
352
],
"parameters": {
"text": "={{ $json.data }}",
"options": {
"systemMessage": "write this into one table. output as dimensions, then metrics"
},
"promptType": "define"
},
"typeVersion": 2.2
}
],
"pinData": {
"When Executed by Another Workflow": [
{
"output": {
"level": "Channel",
"column": "Spend ($)",
"aggregation": "sum"
}
}
]
},
"connections": {
"Max": {
"main": [
[
{
"node": "Bring All Data together",
"type": "main",
"index": 0
}
]
]
},
"Min": {
"main": [
[
{
"node": "Bring All Data together",
"type": "main",
"index": 0
}
]
]
},
"Sum": {
"main": [
[
{
"node": "Bring All Data together",
"type": "main",
"index": 0
}
]
]
},
"Count": {
"main": [
[
{
"node": "Bring All Data together",
"type": "main",
"index": 0
}
]
]
},
"Average": {
"main": [
[
{
"node": "Bring All Data together",
"type": "main",
"index": 0
}
]
]
},
"Get Data": {
"main": [
[
{
"node": "Type of Aggregation",
"type": "main",
"index": 0
}
]
]
},
"Count Unique": {
"main": [
[
{
"node": "Bring All Data together",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Talk to Data with Gemini",
"type": "ai_memory",
"index": 0
}
]
]
},
"Get Column Info": {
"ai_tool": [
[
{
"node": "Talk to Data with Gemini",
"type": "ai_tool",
"index": 0
}
]
]
},
"Type of Aggregation": {
"main": [
[
{
"node": "Count Unique",
"type": "main",
"index": 0
}
],
[
{
"node": "Sum",
"type": "main",
"index": 0
}
],
[
{
"node": "Average",
"type": "main",
"index": 0
}
],
[
{
"node": "Min",
"type": "main",
"index": 0
}
],
[
{
"node": "Max",
"type": "main",
"index": 0
}
],
[
{
"node": "Count",
"type": "main",
"index": 0
}
]
]
},
"Bring All Data together": {
"main": [
[
{
"node": "Write into Table Output",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Talk to Data with Gemini",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Talk to Data with Gemini",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Talk to Data with Gemini": {
"main": [
[
{
"node": "Execute Workflow - Summarize Data",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "Write into Table Output",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Execute Workflow - Summarize Data": {
"main": [
[]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Get Data",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-4洞察和PDF.co从Google Sheets生成营销报告
使用GPT-4洞察和PDF.co从Google Sheets生成营销报告
Code
Merge
Aggregate
+8
15 节点Robert Breen
文档提取
博客写作与编辑器
基于Google Sheets记忆的博客写作与编辑器 (GPT-4)
If
Code
Filter
+10
18 节点Robert Breen
内容创作
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
LinkedIn和X病毒内容自动引擎
使用AI生成和发布自动创建LinkedIn和X的病毒内容
If
Set
Wait
+26
156 节点Diptamoy Barman
内容创作
使用GPT-4o将自然语言转换为Google Sheets SQL查询
使用GPT-4o将自然语言转换为Google Sheets SQL查询
Http Request
Agent
Google Sheets Tool
+5
12 节点Robert Breen
文档提取
AI网站聊天机器人 - GPT与Google表格CRM线索收集
集成GPT和Google表格的AI网站聊天机器人 - CRM线索收集系统
Code
Google Sheets
Agent
+7
14 节点Robert Breen
潜在客户开发
工作流信息
难度等级
高级
节点数量22
分类2
节点类型12
作者
Robert Breen
@rbreenProfessional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.
外部链接
在 n8n.io 查看 →
分享此工作流