Gmail到Google Drive邮件导出工作流
中级
这是一个IT Ops领域的自动化工作流,包含 13 个节点。主要使用 Set, Code, Gmail, GoogleDrive, ConvertToFile 等节点。 Gmail到Google Drive邮件导出工作流
前置要求
- •Google 账号和 Gmail API 凭证
- •Google Drive API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "7d8066d2f56a07000fe7d753d3eeabf0ecdf68413466f30d10afe0906f058427",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "00de0985-997a-4c97-9a4a-d28fae9a9641",
"name": "Gmail",
"type": "n8n-nodes-base.gmail",
"position": [
380,
0
],
"webhookId": "75613b2e-370c-4ecf-bc04-8170d2f594d4",
"parameters": {
"simple": false,
"filters": {
"sender": "akhilgadiraju@gmail.com"
},
"options": {},
"operation": "getAll",
"returnAll": true
},
"credentials": {
"gmailOAuth2": {
"id": "wqFUFuFpF5eRAp4E",
"name": "Gmail OAuth2 - Akhil"
}
},
"typeVersion": 2.1
},
{
"id": "7b167ae9-5a1d-4bd3-b18e-c1cd8da06559",
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
1260,
0
],
"parameters": {
"name": "={{ $now + \"_n8n_export.csv\" }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "LxzMJWxwgbnYKUly",
"name": "Google Drive - Akhil"
}
},
"typeVersion": 3
},
{
"id": "522a4ece-e0dc-4639-81d3-2f4a1b9f459e",
"name": "转换为文件",
"type": "n8n-nodes-base.convertToFile",
"position": [
1040,
0
],
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "f2e29c64-91c7-48b4-8416-eaf98b014596",
"name": "解析数据",
"type": "n8n-nodes-base.set",
"position": [
600,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "2b446be8-1d0c-4a61-8896-f0a90f5100ea",
"name": "id",
"type": "string",
"value": "={{ $json.id }}"
},
{
"id": "8263ed23-ae85-4bdc-8c24-fe5fc3f12601",
"name": "subject",
"type": "string",
"value": "={{ $json.subject }}"
},
{
"id": "09ceff74-3064-4103-aa06-f56693d02765",
"name": "message",
"type": "string",
"value": "={{ $json.text }}"
},
{
"id": "6df559f5-d6b4-4fa4-8f7e-7e63a3c27994",
"name": "time",
"type": "string",
"value": "={{ $json.date }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "399c6f2c-b59a-4e44-aba7-b0a65eb61423",
"name": "启动工作流",
"type": "n8n-nodes-base.manualTrigger",
"position": [
160,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "4d245499-f824-4887-85f0-5cd199c2e648",
"name": "结束工作流",
"type": "n8n-nodes-base.noOp",
"position": [
1480,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "d76bc543-75d6-4c9c-ac84-4b05be377e06",
"name": "转换时间字段",
"type": "n8n-nodes-base.code",
"position": [
820,
0
],
"parameters": {
"jsCode": "return $input.all().map(item => {\n const isoTime = item.json.time;\n\n const date = new Date(isoTime).toLocaleString('en-US', {\n timeZone: 'Asia/Kolkata', // 🔁 Change this to your UAT timezone\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n hour12: true\n });\n\n return {\n json: {\n ...item.json,\n time: date\n }\n };\n});\n"
},
"typeVersion": 2
},
{
"id": "93d5dfcf-c902-4471-9a04-6e7473417bd0",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
-120
],
"parameters": {
"width": 280,
"height": 100,
"content": "### 更改发件人邮箱"
},
"typeVersion": 1
},
{
"id": "97f660ed-281b-4ba9-9656-777b9aea2ef0",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
520,
160
],
"parameters": {
"width": 280,
"height": 100,
"content": "### 添加更多邮件字段"
},
"typeVersion": 1
},
{
"id": "825055a9-8e4f-4e39-ae2f-729c103568d6",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
740,
-100
],
"parameters": {
"height": 80,
"content": "### 更改时区"
},
"typeVersion": 1
},
{
"id": "3f78a5a8-5cd4-40a0-be5f-d984e952d975",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
920,
160
],
"parameters": {
"width": 300,
"height": 100,
"content": "### 更改文件格式"
},
"typeVersion": 1
},
{
"id": "ffbf9a23-dc2c-4ebe-986e-2aff8a170b51",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1160,
-220
],
"parameters": {
"width": 280,
"height": 200,
"content": "### 重命名输出文件"
},
"typeVersion": 1
},
{
"id": "93836b97-81d9-47d4-b8dc-3d856e78090a",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
-580
],
"parameters": {
"width": 580,
"height": 200,
"content": "## 🚀 使用场景"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Gmail": {
"main": [
[
{
"node": "Parse Data",
"type": "main",
"index": 0
}
]
]
},
"Parse Data": {
"main": [
[
{
"node": "Convert Time Field",
"type": "main",
"index": 0
}
]
]
},
"Google Drive": {
"main": [
[
{
"node": "End Workflow",
"type": "main",
"index": 0
}
]
]
},
"Start Workflow": {
"main": [
[
{
"node": "Gmail",
"type": "main",
"index": 0
}
]
]
},
"Convert to File": {
"main": [
[
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Convert Time Field": {
"main": [
[
{
"node": "Convert to File",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - IT 运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Gmail附件备份到Google Drive
Gmail附件备份到Google Drive
Code
Gmail
Google Drive
+3
8 节点Akhil Varma Gadiraju
IT 运维
AI驱动的知识助手
基于AI的知识助手,使用Google Sheets、OpenAI和Supabase向量搜索
Set
Code
Gmail
+7
14 节点Akhil Varma Gadiraju
工程
批量自动共享Google Drive文件并生成直接下载链接
批量自动共享Google Drive文件并生成直接下载链接
Set
Code
Merge
+5
9 节点Nskha
IT 运维
会议反馈收集与Excel OneDrive记录及Outlook通知
通过表单收集会议反馈,记录到Excel OneDrive,并发送Outlook通知
If
Set
Code
+7
13 节点Akhil Varma Gadiraju
营销
使用Gmail、OpenAI和Google Drive提取和分类发票与收据
使用Gmail、OpenAI和Google Drive提取和分类发票与收据
If
Set
Code
+10
20 节点Tom
财务
Gmail到向量嵌入与PGVector和Ollama
使用PGVector和Ollama的Gmail向量嵌入
If
Set
Code
+12
20 节点Alfonso Corretti
客户支持