批量文件上传至Google Drive并管理文件夹
中级
这是一个HR, IT Ops领域的自动化工作流,包含 13 个节点。主要使用 If, Set, Code, FormTrigger, GoogleDrive 等节点。 批量文件上传至Google Drive并管理文件夹
前置要求
- •Google Drive API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "d4d7965840e96e50a3e02959a8487c692901dfa8d5cc294134442c67ce1622d3",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "9252c041-d6b2-49fe-8edb-8d8cb8a1341d",
"name": "表单提交时",
"type": "n8n-nodes-base.formTrigger",
"position": [
240,
0
],
"webhookId": "0c5c8b39-06a7-4d07-95be-b729d2a9eb6f",
"parameters": {
"options": {},
"formTitle": "Batch File Upload to Google Drive",
"formFields": {
"values": [
{
"fieldType": "file",
"fieldLabel": "file",
"requiredField": true
},
{
"fieldLabel": "folderName",
"requiredField": true
}
]
},
"formDescription": "Use this form to upload multiple files to a specific Google Drive folder. Simply select your files and specify your target folder name. If the folder doesn't exist yet, we'll create it automatically for you. This streamlined process allows you to organize and store multiple files in one go, saving you time and effort."
},
"typeVersion": 2.2
},
{
"id": "e27712ac-238d-4b45-b842-a044dc40dccd",
"name": "获取文件夹名称",
"type": "n8n-nodes-base.set",
"position": [
560,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1b997842-86f3-4bce-b8d2-e8d73387dae1",
"name": "folderName",
"type": "string",
"value": "={{ $json.folderName }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "555e761a-ea79-40eb-b36f-72fbcc642fda",
"name": "搜索特定文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
800,
0
],
"parameters": {
"filter": {},
"options": {},
"resource": "fileFolder",
"queryString": "=mimeType='application/vnd.google-apps.folder' and name = '{{ $json.folderName }}' and '<folderId>' in parents\n",
"searchMethod": "query"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "2SIFnsVfdw9nx9I4",
"name": "Google Drive account"
}
},
"executeOnce": false,
"typeVersion": 3,
"alwaysOutputData": true
},
{
"id": "2a92c031-44e5-4e07-89ff-058251c43027",
"name": "找到文件夹?",
"type": "n8n-nodes-base.if",
"position": [
1280,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "11abd7e3-d90b-4bb1-a8ba-d3cbc4333d8f",
"operator": {
"type": "object",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e413cdc8-8424-41d3-8791-e036392a16ac",
"name": "Create Folder",
"type": "n8n-nodes-base.googleDrive",
"position": [
1680,
100
],
"parameters": {
"name": "={{ $('On form submission').item.json.folderName }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "17sGS9HdmAtgpd5rC1sVuiIUGyw2hq9IY",
"cachedResultUrl": "https://drive.google.com/drive/folders/17sGS9HdmAtgpd5rC1sVuiIUGyw2hq9IY",
"cachedResultName": "n8n"
},
"resource": "folder"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "2SIFnsVfdw9nx9I4",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "aada549c-3bbd-453b-9d48-4ab25446d8ce",
"name": "上传文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
2180,
-100
],
"parameters": {
"name": "={{ $json.fileName }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Search specific folder').item.json.id }}"
},
"inputDataFieldName": "=data"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "2SIFnsVfdw9nx9I4",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "7b4bcb6e-3b63-4243-8f38-a18f3d5d44f2",
"name": "准备上传文件",
"type": "n8n-nodes-base.code",
"position": [
1920,
-100
],
"parameters": {
"jsCode": "let results = [];\nconst items = $(\"On form submission\").all()\n\nfor (item of items) {\n for (key of Object.keys(item.binary)) {\n results.push({\n json: {\n fileName: item.binary[key].fileName\n },\n binary: {\n data: item.binary[key],\n }\n });\n }\n}\n\nreturn results;"
},
"typeVersion": 2
},
{
"id": "1d08ef78-68e7-4901-80fc-17923344fee3",
"name": "准备新文件夹文件",
"type": "n8n-nodes-base.code",
"position": [
1920,
100
],
"parameters": {
"jsCode": "let results = [];\nconst items = $(\"On form submission\").all()\n\nfor (item of items) {\n for (key of Object.keys(item.binary)) {\n results.push({\n json: {\n fileName: item.binary[key].fileName\n },\n binary: {\n data: item.binary[key],\n }\n });\n }\n}\n\nreturn results;"
},
"typeVersion": 2
},
{
"id": "557d2c63-7bbb-4280-b16e-71c6d900973b",
"name": "上传到新文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
2180,
100
],
"parameters": {
"name": "={{ $json.fileName }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create Folder').item.json.id }}"
},
"inputDataFieldName": "=data"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "2SIFnsVfdw9nx9I4",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "e90ccfb0-cf21-45d2-860e-bc2049ed9682",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-200
],
"parameters": {
"color": 5,
"width": 520,
"height": 520,
"content": "# 🗂️ 批量文件上传至 Google Drive 并管理文件夹"
},
"typeVersion": 1
},
{
"id": "cd00c8a3-42e3-44f4-89b3-663da809346c",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1100,
-440
],
"parameters": {
"color": 5,
"width": 460,
"height": 380,
"content": "## 🔄 决策点:文件夹检查"
},
"typeVersion": 1
},
{
"id": "a0b1ff8a-3308-41da-bb4b-01b50cccc456",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1920,
-340
],
"parameters": {
"color": 5,
"width": 360,
"height": 200,
"content": "## ⚙️ 文件处理说明"
},
"typeVersion": 1
},
{
"id": "c16b2105-638d-4d48-b39d-ff8772375674",
"name": "便签 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
-340
],
"parameters": {
"color": 5,
"width": 660,
"height": 280,
"content": "## 🔍 搜索查询模式"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"e413cdc8-8424-41d3-8791-e036392a16ac": {
"main": [
[
{
"node": "1d08ef78-68e7-4901-80fc-17923344fee3",
"type": "main",
"index": 0
}
]
]
},
"2a92c031-44e5-4e07-89ff-058251c43027": {
"main": [
[
{
"node": "7b4bcb6e-3b63-4243-8f38-a18f3d5d44f2",
"type": "main",
"index": 0
}
],
[
{
"node": "e413cdc8-8424-41d3-8791-e036392a16ac",
"type": "main",
"index": 0
}
]
]
},
"e27712ac-238d-4b45-b842-a044dc40dccd": {
"main": [
[
{
"node": "555e761a-ea79-40eb-b36f-72fbcc642fda",
"type": "main",
"index": 0
}
]
]
},
"9252c041-d6b2-49fe-8edb-8d8cb8a1341d": {
"main": [
[
{
"node": "e27712ac-238d-4b45-b842-a044dc40dccd",
"type": "main",
"index": 0
}
]
]
},
"555e761a-ea79-40eb-b36f-72fbcc642fda": {
"main": [
[
{
"node": "2a92c031-44e5-4e07-89ff-058251c43027",
"type": "main",
"index": 0
}
]
]
},
"7b4bcb6e-3b63-4243-8f38-a18f3d5d44f2": {
"main": [
[
{
"node": "aada549c-3bbd-453b-9d48-4ab25446d8ce",
"type": "main",
"index": 0
}
]
]
},
"1d08ef78-68e7-4901-80fc-17923344fee3": {
"main": [
[
{
"node": "557d2c63-7bbb-4280-b16e-71c6d900973b",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 人力资源, IT 运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-4.1、Outlook和Mem.ai自动化Microsoft
使用GPT-4.1、Outlook和Mem.ai自动化Microsoft Teams会议分析
If
Set
Code
+
If
Set
Code
61 节点Wayne Simpson
人力资源
Hacker News招聘信息抓取和解析
Hacker News招聘信息抓取和解析
Set
Code
Limit
+
Set
Code
Limit
20 节点Julian Kaiser
人力资源
第一轮 Telegram 和 LinkedIn 快速通道 AI 招聘助手
AI候选人筛选流程:LinkedIn到Telegram,集成Gemini与Apify
If
Set
Code
+
If
Set
Code
55 节点Dean Pike
人力资源
HireMind – AI驱动的简历智能处理流程
HR AI简历筛选与评估:GPT-4和Google Workspace
If
Code
Slack
+
If
Code
Slack
26 节点Trung Tran
人力资源
基于AI的Loom视频问答(Gemini-2.5和Slack通知)
基于AI的Loom视频问答:使用Gemini-2.5和Slack通知
If
Set
Code
+
If
Set
Code
24 节点GiovanniSegar
人工智能
OnboardAIgen - Slack x Jira x Drive 入职自动化工作流
通过 Slack、Jira 和 Google Workspace 集成实现员工入职自动化
If
Set
Code
+
If
Set
Code
77 节点Velebit from Innovatio
人力资源
工作流信息
难度等级
中级
节点数量13
分类2
节点类型6
作者
Julian Kaiser
@jksrFull Stack Developer turned AI & Automation Engineer, implementing intelligent solutions with custom code, LLMs & n8n. Use my link to book a consultation on automating your business processes.
外部链接
在 n8n.io 查看 →
分享此工作流