8
n8n 中文网amn8n.com

通过Web表单保存到Google表格

中级

这是一个Lead Generation领域的自动化工作流,包含 11 个节点。主要使用 Code, Wait, Webhook, GoogleSheets, SplitInBatches 等节点。 自动化Web表单数据收集并存储到Google表格

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "SovVLaYsdGLMJPnS",
  "meta": {
    "instanceId": "cb9a1e5321767b6316634728341237e564b2587ab15b74ca0a89eb02a53484d6",
    "templateCredsSetupCompleted": true
  },
  "name": "通过 Web 表单保存到 Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "cf2ed5e3-f96a-48d2-af22-360e3009bc3d",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "onError": "continueRegularOutput",
      "position": [
        1216,
        320
      ],
      "parameters": {
        "options": {}
      },
      "notesInFlow": false,
      "typeVersion": 3
    },
    {
      "id": "30199601-bb17-4eff-a5ee-00555e0c21ae",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        512,
        320
      ],
      "webhookId": "93a81ced-e52c-4d31-96d2-c91a20bd7453",
      "parameters": {
        "path": "93a81ced-e52c-4d31-96d2-c91a20bd7453",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "2fd4f703-b974-44b0-9fb5-31de9107ff00",
      "name": "在表格中存储数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1552,
        240
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $json.submitted_date }}",
            "Name": "={{ $json.name }}",
            "Email ": "={{ $json.email }}",
            "Location": "={{ $json.location }}",
            "Business Name": "={{ $json.business_name }}",
            "WhatsApp Number": "={{ $json.whatsapp }}"
          },
          "schema": [
            {
              "id": "Business Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Business Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "WhatsApp Number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "WhatsApp Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jGQybPhdWyDQNU2wvVP__PbxInReSa3dBtw2yTSOWKg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jGQybPhdWyDQNU2wvVP__PbxInReSa3dBtw2yTSOWKg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jGQybPhdWyDQNU2wvVP__PbxInReSa3dBtw2yTSOWKg/edit?usp=drivesdk",
          "cachedResultName": "Sales - Save to Google Sheets"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gFH3Wjq6yYqSEAei",
          "name": "Google Sheets"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "78904589-f8b2-45ec-bdf5-b9dc6771b5c3",
      "name": "清理响应数据",
      "type": "n8n-nodes-base.code",
      "position": [
        848,
        320
      ],
      "parameters": {
        "jsCode": "// Get current date in YYYY-MM-DD format\nconst submitted_at = new Date().toISOString().split('T')[0];\n\n// Return only the submitted form data along with the date\nreturn [\n  {\n    json: {\n      business_name: $json.body.business_name,\n      location: $json.body.location,\n      whatsapp: $json.body.whatsapp,\n      email: $json.body.email,\n      name: $json.body.name,\n      submitted_date: submitted_at\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "87e98656-6854-4d62-b2cf-6b64ef138506",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        -368
      ],
      "parameters": {
        "color": 4,
        "width": 992,
        "height": 1488,
        "content": "# 通过 Web 表单保存到 Google Sheets"
      },
      "typeVersion": 1
    },
    {
      "id": "3e600129-67b3-4b48-874b-91fb227dc62f",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -368
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 960,
        "content": "## **Webhook 触发器**"
      },
      "typeVersion": 1
    },
    {
      "id": "219a09fc-7e16-4630-b5c5-1f8c43d4d999",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -368
      ],
      "parameters": {
        "width": 368,
        "height": 960,
        "content": "## **清理和构建传入数据**"
      },
      "typeVersion": 1
    },
    {
      "id": "f37db36d-028a-4022-ab44-b4539f0cb22e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        -368
      ],
      "parameters": {
        "color": 5,
        "width": 304,
        "height": 960,
        "content": "## **用于批处理的循环**"
      },
      "typeVersion": 1
    },
    {
      "id": "2f47f2f7-433a-4557-b9e8-ffa86c2127da",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1424,
        -368
      ],
      "parameters": {
        "color": 4,
        "width": 368,
        "height": 960,
        "content": "## **将数据追加到 Google Sheets**"
      },
      "typeVersion": 1
    },
    {
      "id": "1088b3f4-546c-40dc-9443-1ab617aeaa09",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1808,
        -368
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 960,
        "content": "## **等待**"
      },
      "typeVersion": 1
    },
    {
      "id": "eeb0a16e-d621-4a58-8231-d5812c69e9b1",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1952,
        320
      ],
      "webhookId": "a8a457d5-f88d-451c-ac51-1af17c8435b0",
      "parameters": {},
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "da42ef3c-4244-4b49-9da6-80b63b429d59",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Clean response data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Store Data in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean response data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Data in Sheet": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发

需要付费吗?

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

工作流信息
难度等级
中级
节点数量11
分类1
节点类型6
难度说明

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

作者
SpaGreen Creative

SpaGreen Creative

@spagreen

SpaGreen Creative is a leading software company specializing in SaaS solutions, AI automation, and Laravel/Vue.js development. With 800+ eCommerce platforms and 8,000+ global clients, we deliver powerful tools for OTT, CRM, ERP, and WhatsApp marketing. We combine innovation and tech to build scalable digital products.

外部链接
在 n8n.io 查看

分享此工作流