8
n8n 中文网amn8n.com

合规报告收集器

中级

这是一个File Management, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Set, Merge, MySql, Function, GoogleDrive 等节点。 基于 Google 表单 → Drive + MySQL 的合规报告收集器

前置要求
  • MySQL 数据库连接信息
  • Google Drive API 凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Un9KXLeARM23XTIQ",
  "meta": {
    "instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa",
    "templateCredsSetupCompleted": true
  },
  "name": "合规报告收集器",
  "tags": [],
  "nodes": [
    {
      "id": "c1d13027-17a3-485a-b43b-e7fece0612c6",
      "name": "Google Sheets 表单触发器",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -440,
        60
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1U4MfFW06VMW0gW3fAkGFDvDnomb1j_0E-0lbEkPlli0",
          "cachedResultUrl": "",
          "cachedResultName": "compliance_report_sheet(Responses)"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "id": "WF8FtUtPeBSlrlAC",
          "name": "Google Sheets Trigger account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "038c1dae-f38c-4a98-ae1d-5376d81e3332",
      "name": "记录到 MySQL",
      "type": "n8n-nodes-base.mySql",
      "position": [
        660,
        60
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "report_logs"
        },
        "options": {}
      },
      "credentials": {
        "mySql": {
          "id": "YqKBp66liP3vXdbi",
          "name": "MySQL account 4"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d644afd6-ad2e-4931-ba17-42c1d635c3fc",
      "name": "重命名字段",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        60
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "=\n{\n  \"reporter\": \"{{$json.reporter}}\",\n  \"category\": \"{{$json.category}}\",\n  \"timestamp\": \"{{$json.timestamp}}\",\n  \"folder_id\": \"{{$json.folder_id}}\",\n  \"file_name\": \"{{$binary.data.fileName}}\",\n  \"mime_type\": \"{{$binary.data.mimeType}}\",\n  \"email\": \"{{$json.email}}\",\n  \"description\": \"{{$json.description}}\"\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "ba6a2d4c-f548-446f-ab24-20c518e06f86",
      "name": "提取 Google Sheets 数据",
      "type": "n8n-nodes-base.function",
      "notes": "Extract metadata for logging",
      "position": [
        -220,
        60
      ],
      "parameters": {
        "functionCode": "// Input: rows from Google Sheets Trigger\nconst rows = $input.all();\nconst out = [];\n\nfor (const item of rows) {\n  const j = item.json;\n\n  const url = j['Upload Report File'] || '';\n  // supports both ?id=... and /d/.../view URLs\n  const m =\n    url.match(/[?&]id=([^&]+)/) ||\n    url.match(/\\/d\\/([a-zA-Z0-9_-]+)/);\n\n  out.push({\n    json: {\n      reporter: j['Reporter Name'] || null,\n      category: j['Report Category'] || null,\n      timestamp: new Date(j['Timestamp']).toISOString(),\n      folder_id: m ? m[1] : null,\n      email: j['Email Address'] || null,\n      description: j['Description'] || null,\n    },\n  });\n}\n\nreturn out;\n"
      },
      "typeVersion": 1
    },
    {
      "id": "efa9cce4-db44-4296-8c76-9bf12ca68d52",
      "name": "获取文件上传元数据",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        0,
        60
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.folder_id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "dkusrOXTExpMxEAe",
          "name": "Google Drive account 7"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "6abc9f56-0b24-4e47-840f-72ac8421d90c",
      "name": "合并表格和文件数据",
      "type": "n8n-nodes-base.merge",
      "position": [
        220,
        60
      ],
      "parameters": {
        "mode": "combine",
        "options": {
          "includeUnpaired": true
        },
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2,
      "alwaysOutputData": true
    },
    {
      "id": "779477a4-ecac-4cd5-8b5f-e385da6c64fc",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -100
      ],
      "parameters": {
        "width": 1400,
        "height": 420,
        "content": "## 合规报告收集器(Google 表单 → Drive + MySQL)"
      },
      "typeVersion": 1
    },
    {
      "id": "071841f7-f553-4637-806a-0db0d27e8de4",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        380
      ],
      "parameters": {
        "width": 1420,
        "height": 1240,
        "content": "## 功能说明"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7f30bbf3-aa3d-462b-b69e-7bf403e3c880",
  "connections": {
    "Rename Fields": {
      "main": [
        [
          {
            "node": "Log to MySQL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge sheet & file data": {
      "main": [
        [
          {
            "node": "Rename Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract googlesheet data": {
      "main": [
        [
          {
            "node": "Get file uploaded metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file uploaded metadata": {
      "main": [
        [
          {
            "node": "Merge sheet & file data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets form Trigger": {
      "main": [
        [
          {
            "node": "Extract googlesheet data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 文件管理, 多模态 AI

需要付费吗?

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

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

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

作者
WeblineIndia

WeblineIndia

@weblineindia

A Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.

外部链接
在 n8n.io 查看

分享此工作流