8
n8n 中文网amn8n.com

通过合并数据集使用Google Drive和Sheets创建多工作表Excel工作簿

中级

这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 Code, Merge, GoogleDrive, GoogleSheets, ConvertToFile 等节点。 通过合并数据集使用Google Drive和Sheets创建多工作表Excel工作簿

前置要求
  • Google Drive API 凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5432b2ed-adde-4021-b6b3-e75e43bd102c",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -576,
        1728
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "dcdb5d9e-4f54-46af-8f45-b922cad98117",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        288,
        1344
      ],
      "parameters": {
        "options": {
          "sheetName": "Sheet1"
        },
        "operation": "xlsx"
      },
      "typeVersion": 1.1
    },
    {
      "id": "f4bd8d4b-0a5b-457a-819e-1caf7a3c6363",
      "name": "转换为文件1",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        288,
        1632
      ],
      "parameters": {
        "options": {
          "sheetName": "Sheet2"
        },
        "operation": "xlsx",
        "binaryPropertyName": "data2"
      },
      "typeVersion": 1.1
    },
    {
      "id": "f9ab703d-41fb-4e69-841a-62a952644084",
      "name": "合并1",
      "type": "n8n-nodes-base.merge",
      "position": [
        624,
        1504
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "021b89d0-278d-4c85-9b67-f51baa3a0231",
      "name": "便签60",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        1264
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 624,
        "content": "### 1️⃣ 连接 Google Sheets (OAuth2)"
      },
      "typeVersion": 1
    },
    {
      "id": "dd8fef83-2469-4630-863e-08a307930e8a",
      "name": "便签62",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        1424
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 544,
        "content": "### 2️⃣ 连接 Google Drive (OAuth2)"
      },
      "typeVersion": 1
    },
    {
      "id": "b5413d5e-1efe-417e-b7c4-3ae52112d8ee",
      "name": "便签54",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -736,
        1040
      ],
      "parameters": {
        "color": 7,
        "width": 2144,
        "height": 1056,
        "content": "### 在 n8n 中创建多工作表 Excel 工作簿,使用 Google Drive + Google Sheets 自动化报告"
      },
      "typeVersion": 1
    },
    {
      "id": "203a12f7-582d-4664-bbbf-e1f6f3093567",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        1040
      ],
      "parameters": {
        "width": 400,
        "height": 1056,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e2a70f89-3424-4518-8bff-68e239b798c8",
      "name": "数据集 1",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        1232
      ],
      "parameters": {
        "jsCode": "// Example: First two columns of data\nreturn [\n  { json: { Name: \"Alice\", Age: 30 } },\n  { json: { Name: \"Bob\", Age: 25 } },\n  { json: { Name: \"Charlie\", Age: 35 } },\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a700ca4e-57a2-4a23-ad99-9ad8abcace41",
      "name": "数据集 2",
      "type": "n8n-nodes-base.code",
      "position": [
        32,
        1520
      ],
      "parameters": {
        "jsCode": "// Example: Another two columns of data\nreturn [\n  { json: { City: \"New York\", Country: \"USA\" } },\n  { json: { City: \"London\", Country: \"UK\" } },\n  { json: { City: \"Tokyo\", Country: \"Japan\" } },\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "62762267-68ef-4750-9703-ca9d6a1fe424",
      "name": "保存到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        960,
        1744
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "City",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "City",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Country",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Country",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1978181834,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1G6FSm3VdMZt6VubM6g8j0mFw59iEw9npJE0upxj3Y6k/edit#gid=1978181834",
          "cachedResultName": "two"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1G6FSm3VdMZt6VubM6g8j0mFw59iEw9npJE0upxj3Y6k",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1G6FSm3VdMZt6VubM6g8j0mFw59iEw9npJE0upxj3Y6k/edit?usp=drivesdk",
          "cachedResultName": "Blank"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1cd9ffc5-5a41-4fa6-9a45-0dcade22fd37",
      "name": "导出 Excel 文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -176,
        1824
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "list",
          "value": "1G6FSm3VdMZt6VubM6g8j0mFw59iEw9npJE0upxj3Y6k",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1G6FSm3VdMZt6VubM6g8j0mFw59iEw9npJE0upxj3Y6k/edit?usp=drivesdk",
          "cachedResultName": "Blank"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "pl7bkYVKthXr65dR",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    }
  ],
  "pinData": {},
  "connections": {
    "Merge1": {
      "main": [
        [
          {
            "node": "Save to google sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data Set 1": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data Set 2": {
      "main": [
        [
          {
            "node": "Convert to File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File1": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Export Excel file",
            "type": "main",
            "index": 0
          },
          {
            "node": "Data Set 1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Data Set 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 文档提取, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量12
分类2
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Robert Breen

Robert Breen

@rbreen

Professional 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 查看

分享此工作流