使用Google表格和Gmail通知自动化随机家务分配
中级
这是一个自动化工作流,包含 15 个节点。主要使用 Code, Gmail, GoogleSheets, ScheduleTrigger 等节点。 通过Google表格和Gmail通知实现随机家务分配的自动化
前置要求
- •Google 账号和 Gmail API 凭证
- •Google Sheets API 凭证
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "0867aa2e4fb4e86d170a6ca997a164fd02d27420eb0e7cb54482c4b03d1672ac",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "2346a47e-4dc0-4017-83f4-c45098e88319",
"name": "由 Github 模型提供支持",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1568,
-288
],
"parameters": {
"rule": {
"interval": [
{
"daysInterval": 7
}
]
}
},
"typeVersion": 1
},
{
"id": "ac1a1dc4-ab83-41cc-a4f9-78f200aeb324",
"name": "获取任务",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1296,
-288
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit#gid=0",
"cachedResultName": "Tasks"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit?usp=drivesdk",
"cachedResultName": "Chore_scheduler"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "x23VLPzDtSY8QGZL",
"name": "Google Sheets account"
}
},
"typeVersion": 3
},
{
"id": "cb86134c-7f25-48f2-af87-2297386ca3be",
"name": "获取人员",
"type": "n8n-nodes-base.googleSheets",
"position": [
-992,
-288
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 307557581,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit#gid=307557581",
"cachedResultName": "Persons"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit?usp=drivesdk",
"cachedResultName": "Chore_scheduler"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "x23VLPzDtSY8QGZL",
"name": "Google Sheets account"
}
},
"typeVersion": 3
},
{
"id": "5870874f-35ce-4b0d-8230-ec7c27fa71eb",
"name": "发送消息",
"type": "n8n-nodes-base.gmail",
"position": [
-384,
-288
],
"webhookId": "8c1a3396-8d92-419e-ac17-794f5ecbfa98",
"parameters": {
"sendTo": "={{ $('Filter Data and Assign Tasks').item.json.email }}",
"message": "=Hello {{ $('Filter Data and Assign Tasks').item.json.assigned_to }}!\n\nThe homework assigned to you this week is: {{ $('Filter Data and Assign Tasks').item.json.task }}.\n{{ $('Filter Data and Assign Tasks').item.json.description }}\n\nHave a good day!",
"options": {},
"subject": "=Task selection"
},
"credentials": {
"gmailOAuth2": {
"id": "Lq6xBv8sVLgAMlGL",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "0c83e351-1158-4577-9f24-06297d7477fb",
"name": "过滤数据并分配任务",
"type": "n8n-nodes-base.code",
"position": [
-688,
-288
],
"parameters": {
"jsCode": "let tasks = $items('Get Tasks');\nlet people = $items('Get People');\n\n// Filter persons without Email\npeople = people.filter(item => {\n const email = item.json.email;\n return email && email.toString().trim() !== '';\n});\n\n// Filter tasks undefined\ntasks = tasks.filter(item => {\n const task = item.json.task;\n return task && task.toString().trim() !== '';\n});\n\n// Error if there aren´t any persons\nif (people.length === 0) {\n throw new Error('No hay personas con correo electrónico para asignar las tareas.');\n}\n\n// Assign Tasks\nconst assignments = tasks.map((taskItem, index) => {\n const personItem = people[Math.floor(Math.random() * people.length)];\n return {\n json: {\n row_number: taskItem.json.row_number,\n task: taskItem.json.task,\n description: taskItem.json.description,\n assigned_to: personItem.json.name,\n email: personItem.json.email,\n }\n };\n});\n\nreturn assignments;\n"
},
"typeVersion": 2
},
{
"id": "d5692ac3-3119-4466-a557-15bf38acb8c0",
"name": "更新表中的分配对象",
"type": "n8n-nodes-base.googleSheets",
"position": [
-80,
-288
],
"parameters": {
"columns": {
"value": {
"row_number": "={{ $('Filter Data and Assign Tasks').item.json.row_number }}",
"assigned_to": "={{ $('Filter Data and Assign Tasks').item.json.assigned_to }}"
},
"schema": [
{
"id": "task",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "task",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "description",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "assigned_to",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "assigned_to",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit#gid=0",
"cachedResultName": "Tasks"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit?usp=drivesdk",
"cachedResultName": "Chore_scheduler"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "x23VLPzDtSY8QGZL",
"name": "Google Sheets account"
}
},
"typeVersion": 4.7
},
{
"id": "d60ce508-5931-4250-968b-79f1064ed6de",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2000,
-224
],
"parameters": {
"color": 2,
"width": 320,
"content": "## Sheets 任务示例"
},
"typeVersion": 1
},
{
"id": "17b51b73-044f-4798-a939-fac4daa167df",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2016,
-672
],
"parameters": {
"color": 2,
"width": 352,
"height": 832,
"content": "## 开始前的设置步骤"
},
"typeVersion": 1
},
{
"id": "97d87ab3-a03d-4522-b516-3bbde84306f3",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1984,
-448
],
"parameters": {
"color": 2,
"width": 288,
"height": 208,
"content": "## 人员表 "
},
"typeVersion": 1
},
{
"id": "d8e31fc6-60b1-4ca5-ad1b-70b396bc53e3",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2000,
-48
],
"parameters": {
"color": 2,
"width": 320,
"height": 192,
"content": "## 如何自定义"
},
"typeVersion": 1
},
{
"id": "289e4235-712e-4b95-bace-0eb749181767",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-768,
-464
],
"parameters": {
"color": 7,
"width": 256,
"height": 352,
"content": "**过滤数据并分配任务节点(可选):**"
},
"typeVersion": 1
},
{
"id": "ea1dd9bf-3a8c-42cf-b43e-cb5e6fe12d66",
"name": "### 需要帮助?",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
-464
],
"parameters": {
"color": 7,
"width": 256,
"height": 352,
"content": "**发送消息节点:**"
},
"typeVersion": 1
},
{
"id": "ee4d6fb2-e4a4-44c9-9d1a-ea348ec2ca5f",
"name": "## 试试看!",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
-464
],
"parameters": {
"color": 7,
"width": 256,
"height": 352,
"content": "**更新表中分配对象节点:**"
},
"typeVersion": 1
},
{
"id": "75fc9783-7d22-448b-bd52-559f3ec38ca6",
"name": "GET 模型",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
-464
],
"parameters": {
"color": 7,
"width": 256,
"height": 352,
"content": "**获取人员节点:**"
},
"typeVersion": 1
},
{
"id": "b2b88914-0526-4936-8d5a-b6215dd05eb9",
"name": "## 1. 创建新的自定义 OpenAI 凭据",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1376,
-464
],
"parameters": {
"color": 7,
"width": 256,
"height": 352,
"content": "**获取任务节点:**"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Get Tasks": {
"main": [
[
{
"node": "Get People",
"type": "main",
"index": 0
}
]
]
},
"Get People": {
"main": [
[
{
"node": "Filter Data and Assign Tasks",
"type": "main",
"index": 0
}
]
]
},
"Send a message": {
"main": [
[
{
"node": "Update assign_to in sheet",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get Tasks",
"type": "main",
"index": 0
}
]
]
},
"Update assign_to in sheet": {
"main": [
[]
]
},
"Filter Data and Assign Tasks": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用OpenWeather、表格和Telegram的植物护理提醒
使用OpenWeather、表格和Telegram的植物护理提醒
If
Set
Code
+8
27 节点Adrian
个人效率
AAVE投资组合专业AI助手
Telegram + 邮件 + GPT-4o + Moralis
Set
Code
Gmail
+7
23 节点Don Jayamaha Jr
财务
自动化新闻到简报AI代理v13
AI新闻研究团队:24/7简报自动化,含Perplexity引用
Set
Code
Gmail
+15
37 节点Derek Cheung
产品
基于AI的MIS代理
基于AI的管理信息系统代理
If
Set
Code
+29
129 节点Kumar Shivam
客户支持
自动化X(Twitter)内容引擎
基于AI的X(Twitter)内容生成与调度(LangChain和Blotato)
If
Code
Gmail
+8
24 节点YUSUKE YAMAMOTO
从Monday.com和Jira到Outlook的AI驱动反馈分类与报告
使用Azure GPT-4、Jira任务和Outlook报告分析来自Monday.com的客户反馈
Set
Code
Jira
+12
27 节点Rahul Joshi
工作流信息
难度等级
中级
节点数量15
分类-
节点类型5
作者
Adrian
@nafriExperienced tech professional with 10+ years in Big Data, AI, and automation, former bootcamp director, and passionate about innovation and strategic growth.
外部链接
在 n8n.io 查看 →
分享此工作流