8
n8n 中文网amn8n.com

集成数据整合

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 Merge, MongoDb, Function, Postgres, GoogleSheets 等节点。 整合5个数据源,使用SQL、MongoDB和Google工具实现自动化报告

前置要求
  • MongoDB 连接字符串
  • PostgreSQL 数据库连接信息
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "集成数据整合",
  "nodes": [
    {
      "id": "b28ea25c-3c5e-44ca-856f-d5f057fce8ab",
      "name": "📄 Google Sheets 数据源",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -368,
        32
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_SHEETS_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEETS_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_SHEETS_ID/edit",
          "cachedResultName": "Data"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "04b2a7c3-f5aa-412c-a764-75a6f26e8c28",
      "name": "🐘 PostgreSQL 数据源",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -368,
        224
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "customers",
          "cachedResultName": "customers"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "options": {},
        "operation": "select",
        "returnAll": true
      },
      "typeVersion": 2.4
    },
    {
      "id": "28dd8f01-9a48-473d-926c-ad9eb94ca7b4",
      "name": "🍃 MongoDB 数据源",
      "type": "n8n-nodes-base.mongoDb",
      "position": [
        -368,
        416
      ],
      "parameters": {
        "options": {
          "limit": 1000
        },
        "collection": "your_collection_name"
      },
      "typeVersion": 1.1
    },
    {
      "id": "6f84ea01-55ec-4112-a4d4-11fba9f993ec",
      "name": "⚙️ 处理合并数据",
      "type": "n8n-nodes-base.function",
      "position": [
        288,
        416
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d7a22005-d249-4a68-a970-b72e59639ea2",
      "name": "📊 最终 Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        528,
        416
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LinkedIn",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "LinkedIn",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Notes",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Notes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Seniority",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Seniority",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Confidence Score",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Confidence Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_OUTPUT_SHEETS_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_OUTPUT_GOOGLE_SHEETS_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_OUTPUT_SHEETS_ID/edit",
          "cachedResultName": "Data"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "ed6ff028-8eb9-4ba8-8d82-e3f9ba9f129a",
      "name": "添加 Sheets 数据源 ID",
      "type": "n8n-nodes-base.function",
      "position": [
        -144,
        32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3a01720f-8434-4a36-b02e-d14d9ab092c5",
      "name": "添加 PostgreSQL 数据源 ID",
      "type": "n8n-nodes-base.function",
      "position": [
        -144,
        224
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e55e3811-2291-4e40-9b1f-37e7c7fbe5ad",
      "name": "添加 SQL Server 数据源 ID",
      "type": "n8n-nodes-base.function",
      "position": [
        -144,
        608
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f480146b-4152-4837-a556-d178ea0d33dc",
      "name": "添加 MongoDB 数据源 ID",
      "type": "n8n-nodes-base.function",
      "position": [
        -144,
        416
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b9c0f9ac-ba41-4162-bcbd-f529d4a49c09",
      "name": "添加 Analytics 数据源 ID",
      "type": "n8n-nodes-base.function",
      "position": [
        -144,
        800
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e26d6c59-0d46-4abd-a9cc-82ea2894402e",
      "name": "Microsoft SQL Server",
      "type": "n8n-nodes-base.microsoftSql",
      "position": [
        -368,
        608
      ],
      "parameters": {
        "query": "SELECT * FROM your_table;",
        "operation": "executeQuery"
      },
      "typeVersion": 1.1
    },
    {
      "id": "a8ee48b5-188d-49b8-963f-1570683b3b55",
      "name": "Google Analytics",
      "type": "n8n-nodes-base.googleAnalytics",
      "position": [
        -368,
        800
      ],
      "parameters": {
        "userId": "YOUR_USER_ID",
        "viewId": "YOUR_GA_VIEW_ID",
        "resource": "userActivity",
        "additionalFields": {}
      },
      "typeVersion": 2
    },
    {
      "id": "2a5bdc85-b754-485b-a1fd-435cc07f0ce3",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        80,
        368
      ],
      "parameters": {
        "numberInputs": 5
      },
      "typeVersion": 3.2
    },
    {
      "id": "0dc0d5a7-2a7a-456b-a7e5-f62982d15b9b",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -592,
        416
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1,
                3,
                5
              ]
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a3a4a5b8-e80a-4759-9ab3-5a259f619472",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -336
      ],
      "parameters": {
        "color": 4,
        "width": 640,
        "height": 1296,
        "content": "## 目标:"
      },
      "typeVersion": 1
    },
    {
      "id": "a848bbf0-dcde-4395-b67e-d0b4f60bf7dc",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        -336
      ],
      "parameters": {
        "width": 432,
        "height": 1296,
        "content": "## 合并节点:"
      },
      "typeVersion": 1
    },
    {
      "id": "72ee4227-8bcd-434f-b327-b9fd57e46861",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -336
      ],
      "parameters": {
        "color": 3,
        "width": 256,
        "height": 1296,
        "content": "## 最终数据集写入 Google Sheets。"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "⚙️ Process Merged Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Analytics": {
      "main": [
        [
          {
            "node": "Add Analytics Source ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "📄 Google Sheets Source",
            "type": "main",
            "index": 0
          },
          {
            "node": "🐘 PostgreSQL Source",
            "type": "main",
            "index": 0
          },
          {
            "node": "🍃 MongoDB Source",
            "type": "main",
            "index": 0
          },
          {
            "node": "Microsoft SQL Server",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🍃 MongoDB Source": {
      "main": [
        [
          {
            "node": "Add MongoDB Source ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Sheets Source ID": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft SQL Server": {
      "main": [
        [
          {
            "node": "Add SQL Server Source ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add MongoDB Source ID": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "🐘 PostgreSQL Source": {
      "main": [
        [
          {
            "node": "Add PostgreSQL Source ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Analytics Source ID": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "Add PostgreSQL Source ID": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Add SQL Server Source ID": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "📄 Google Sheets Source": {
      "main": [
        [
          {
            "node": "Add Sheets Source ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Process Merged Data": {
      "main": [
        [
          {
            "node": "📊 Final Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量17
分类2
节点类型9
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Avkash Kakdiya

Avkash Kakdiya

@itechnotion

🚀 Founder of iTechNotion — we build custom AI-powered automation workflows for startups, agencies, and founders. 💡 Specializing in agentic AI systems, content automation, sales funnels, and digital workers. 🔧 14+ years in tech | Building scalable no-code/low-code solutions using n8n, OpenAI, and other API-first tools. 📬 Let’s automate what slows you down.

外部链接
在 n8n.io 查看

分享此工作流