使用Google Sheets、GPT-4o和电子邮件生成营销活动ROI报告
高级
这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 Code, Merge, Aggregate, Summarize, GoogleSheets 等节点。 使用Google Sheets、GPT-4o和电子邮件生成营销活动ROI报告
前置要求
- •Google Sheets API 凭证
- •OpenAI API Key
使用的节点 (16)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "df93659a-1341-4042-885c-1624e5501f3f",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1792,
-176
],
"parameters": {
"width": 540,
"height": 848,
"content": "## 📈 使用生成式AI + 电子邮件的活动投资回报率报告"
},
"typeVersion": 1
},
{
"id": "07bc087a-adc5-4094-8236-bf3c90dfc7db",
"name": "启动工作流",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1088,
64
],
"parameters": {},
"typeVersion": 1
},
{
"id": "07ace160-586f-46b0-8b13-8d7fa467703b",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-224,
528
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4l6TDfLZVFS24g3X",
"name": "OpenAi account 4"
}
},
"typeVersion": 1.2
},
{
"id": "9f3326c5-e0c8-48e6-a560-08ee63ada662",
"name": "结构化输出解析器 1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
96,
272
],
"parameters": {
"jsonSchemaExample": "{\n \"output\": \"Overall, campaign performance was strong this week. Retargeting efforts delivered the highest return, while a few awareness campaigns underperformed in conversions.\\n\\n• 📈 'Spring Retargeting' had the highest ROAS at 9.1\\n• 💰 'Loyalty Push' generated $12,000 revenue on $1,600 spend\\n• 📉 'Awareness Boost - TikTok' had low conversions despite high spend\\n• 🧠 Meta Ads accounted for 70% of total conversions\\n\\nTotals:\\n• Total Spend: $12,480\\n• Impressions: 983,400\\n• Clicks: 23,980\\n• Conversions: 1,482\\n• Revenue: $48,000\"\n}"
},
"typeVersion": 1.3
},
{
"id": "4719e276-755a-4791-9865-d6c12172c0d5",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1216,
272
],
"parameters": {
"color": 7,
"width": 684,
"height": 400,
"content": "### 聚合和合并数据"
},
"typeVersion": 1
},
{
"id": "84d6aad8-d30f-4c77-a134-476065d8d674",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1216,
-176
],
"parameters": {
"color": 3,
"width": 672,
"height": 416,
"content": "### 2. 准备您的Google Sheet"
},
"typeVersion": 1
},
{
"id": "135a26ff-151e-494f-a862-c59063285dc4",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-496,
-176
],
"parameters": {
"color": 7,
"width": 828,
"height": 848,
"content": "### AI代理分析数据并发送每日电子邮件"
},
"typeVersion": 1
},
{
"id": "4b5211e3-46d3-42f7-ad79-64eff2d30567",
"name": "获取数据",
"type": "n8n-nodes-base.googleSheets",
"position": [
-832,
64
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 365710158,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit#gid=365710158",
"cachedResultName": "Data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit?usp=drivesdk",
"cachedResultName": "Sample Marketing Data - n8n"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "HlBW2puZbuCCq8jJ",
"name": "Google Sheets account 3"
}
},
"typeVersion": 4.7
},
{
"id": "5b61292d-8951-4ec2-9274-a9600c5d4d07",
"name": "汇总活动",
"type": "n8n-nodes-base.summarize",
"position": [
-1168,
336
],
"parameters": {
"options": {},
"fieldsToSplitBy": "Campaign",
"fieldsToSummarize": {
"values": [
{
"field": "Spend ($)",
"aggregation": "sum"
},
{
"field": "Clicks",
"aggregation": "sum"
},
{
"field": "Conversions",
"aggregation": "sum"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "19ec9e9f-651f-44d2-868e-cd6742376707",
"name": "汇总渠道",
"type": "n8n-nodes-base.summarize",
"position": [
-1168,
496
],
"parameters": {
"options": {},
"fieldsToSplitBy": "Channel",
"fieldsToSummarize": {
"values": [
{
"field": "Spend ($)",
"aggregation": "sum"
},
{
"field": "Clicks",
"aggregation": "sum"
},
{
"field": "Conversions",
"aggregation": "sum"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "f7f310bb-457c-4784-922d-3ca31ebcbe02",
"name": "合并",
"type": "n8n-nodes-base.aggregate",
"position": [
-1024,
336
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "campaign_performance"
},
"typeVersion": 1
},
{
"id": "200c07d6-05c3-4680-a22b-5ec6803c02a7",
"name": "合并",
"type": "n8n-nodes-base.aggregate",
"position": [
-1024,
496
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "channel_performance"
},
"typeVersion": 1
},
{
"id": "51d56f0e-6c2e-40c4-ac67-445218b9a78e",
"name": "合并结果",
"type": "n8n-nodes-base.merge",
"position": [
-848,
400
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.2
},
{
"id": "7995b9a9-7bc4-4b41-81ac-a33694e42657",
"name": "转换为文本",
"type": "n8n-nodes-base.code",
"position": [
-704,
400
],
"parameters": {
"jsCode": "const campaignData = items[0].json.campaign_performance || [];\nconst channelData = items[0].json.channel_performance || [];\n\nlet campaignSummary = `📊 Campaign Performance:\\n`;\nfor (const entry of campaignData) {\n campaignSummary += `• ${entry.Campaign}: $${entry[\"sum_Spend_($)\"].toFixed(2)} spend, ${entry[\"sum_Clicks\"]} clicks, ${entry[\"sum_Conversions\"]} conversions\\n`;\n}\n\nlet channelSummary = `\\n📣 Channel Performance:\\n`;\nfor (const entry of channelData) {\n channelSummary += `• ${entry.Channel}: $${entry[\"sum_Spend_($)\"].toFixed(2)} spend, ${entry[\"sum_Clicks\"]} clicks, ${entry[\"sum_Conversions\"]} conversions\\n`;\n}\n\nreturn [\n {\n json: {\n output: campaignSummary + channelSummary\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "43390f07-1797-41d7-bee5-40c37f0ff73f",
"name": "分析营销数据",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-144,
0
],
"parameters": {
"text": "=Data: {{ $json.output }}",
"options": {
"systemMessage": "You are a Marketing Performance Assistant.\n\nUse the data access campaign data, including fields like: campaign name, cost, impressions, clicks, conversions, and revenue.\n\n\n\nYour job is to write a clear and helpful summary of campaign performance for a marketing team.\n\nYour response must be in **JSON format** with only one field:\n\n- `\"output\"`: A string that contains:\n - A short paragraph explaining overall performance\n - 3–5 bullet points with key insights\n - Total spend, impressions, clicks, conversions, and revenue (as bullets)\n\nUse natural, business-friendly language and make it sound like part of a weekly email report. Use emojis if helpful. Do not include raw data or tables.\n\n**Example format:**\n\n```json\n{\n \"output\": \"Overall, campaign performance was strong this week. Retargeting efforts delivered the highest return, while a few awareness campaigns underperformed in conversions.\\n\\n• 📈 'Spring Retargeting' had the highest ROAS at 9.1\\n• 💰 'Loyalty Push' generated $12,000 revenue on $1,600 spend\\n• 📉 'Awareness Boost - TikTok' had low conversions despite high spend\\n• 🧠 Meta Ads accounted for 70% of total conversions\\n\\nTotals:\\n• Total Spend: $12,480\\n• Impressions: 983,400\\n• Clicks: 23,980\\n• Conversions: 1,482\\n• Revenue: $48,000\"\n}\n"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "8167ef4f-9a26-4fb3-a885-79a5a5f3664a",
"name": "## 1. 创建新的自定义 OpenAI 凭据",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
304
],
"parameters": {
"color": 3,
"width": 368,
"height": 336,
"content": "### 1. 设置OpenAI连接"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Combine": {
"main": [
[
{
"node": "Merge Results",
"type": "main",
"index": 0
}
]
]
},
"Combine ": {
"main": [
[
{
"node": "Merge Results",
"type": "main",
"index": 1
}
]
]
},
"Get Data": {
"main": [
[
{
"node": "Sum Campaigns",
"type": "main",
"index": 0
},
{
"node": "Sum Channels",
"type": "main",
"index": 0
}
]
]
},
"Sum Channels": {
"main": [
[
{
"node": "Combine ",
"type": "main",
"index": 0
}
]
]
},
"Merge Results": {
"main": [
[
{
"node": "Convert to Text",
"type": "main",
"index": 0
}
]
]
},
"Sum Campaigns": {
"main": [
[
{
"node": "Combine",
"type": "main",
"index": 0
}
]
]
},
"Start Workflow": {
"main": [
[
{
"node": "Get Data",
"type": "main",
"index": 0
}
]
]
},
"Convert to Text": {
"main": [
[
{
"node": "Analyze Marketing Data",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Analyze Marketing Data",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Analyze Marketing Data": {
"main": [
[]
]
},
"Structured Output Parser1": {
"ai_outputParser": [
[
{
"node": "Analyze Marketing Data",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - AI 摘要总结, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-4洞察和PDF.co从Google Sheets生成营销报告
使用GPT-4洞察和PDF.co从Google Sheets生成营销报告
Code
Merge
Aggregate
+8
15 节点Robert Breen
文档提取
使用 Perplexity AI 研究业务线索并使用 OpenAI 保存到 Google Sheets
使用 Perplexity AI 研究业务线索并使用 OpenAI 保存到 Google Sheets
Set
Merge
Split Out
+8
18 节点Robert Breen
杂项
初学者数据分析:使用 GPT-4o 在 Google Sheets 中合并、筛选和汇总
初学者数据分析:使用 GPT-4o 在 Google Sheets 中合并、筛选和汇总
If
Set
Code
+9
21 节点Robert Breen
文档提取
使用 GPT-4o-mini 生成每日 Pipedrive 交易摘要
使用 GPT-4o-mini 生成每日 Pipedrive 交易摘要
Set
Code
Aggregate
+6
14 节点Robert Breen
AI 摘要总结
AI生成LinkedIn帖子含人工审批
使用GPT-4、GoToHuman和Blotato的AI生成LinkedIn帖子含人工审批
Code
Merge
Filter
+10
19 节点Robert Breen
社交媒体
冷线索重新参与邮件生成器:GPT-4o-mini、Outlook和Sheets
冷线索重新参与邮件生成器:GPT-4o-mini、Outlook和Sheets
Code
Aggregate
Google Sheets
+6
15 节点Robert Breen
客户培育
工作流信息
难度等级
高级
节点数量16
分类2
节点类型10
作者
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 查看 →
分享此工作流