8
n8n 中文网amn8n.com

Google Sheets 联系人同步至 SeaTable(更新插入逻辑)

高级

这是一个CRM, Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 If, Set, SeaTable, HttpRequest, GoogleSheets 等节点。 将 Google Sheets 联系人同步至 SeaTable,支持更新/插入逻辑

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e2b72466a589dd1250fc94a8e861457e040bf25b07f6b069958c036d3f2bfe77",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "9c61b9c6-8bfc-4a93-9a00-8c58211d19c0",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -960,
        640
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1211014d-547c-4bef-b164-3f89599e2356",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -288,
        640
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "8cf9862f-edf3-459d-a953-3c9245cf97c0",
      "name": "替换我",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -64,
        368
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "f52c74d9-8523-45e5-8456-88c8e34d0f65",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        160,
        560
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "581f9c5f-c61c-418f-bcad-c9b9e5e23f13",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.isEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7ed9293d-36ab-4010-9c17-e887d6fb4c76",
      "name": "seatable 查找",
      "type": "n8n-nodes-base.seaTable",
      "position": [
        -64,
        560
      ],
      "parameters": {
        "options": {
          "simple": false
        },
        "operation": "search",
        "tableName": "Table1",
        "searchTerm": "={{ $json.email }}",
        "searchColumn": "email"
      },
      "credentials": {
        "seaTableApi": {
          "id": "YBFwe7cXLQNGuChg",
          "name": "SeaTable account"
        }
      },
      "executeOnce": true,
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "3423e503-7818-40a9-a244-ff34e47803a2",
      "name": "创建行",
      "type": "n8n-nodes-base.seaTable",
      "position": [
        384,
        640
      ],
      "parameters": {
        "columnsUi": {
          "columnValues": [
            {
              "columnName": "email",
              "columnValue": "={{ $('contacts').item.json.email }}"
            },
            {
              "columnName": "firstname",
              "columnValue": "={{ $('contacts').item.json.firstname }}"
            },
            {
              "columnName": "lastname",
              "columnValue": "={{ $('contacts').item.json.lastname }}"
            },
            {
              "columnName": "company",
              "columnValue": "={{ $('contacts').item.json.company }}"
            }
          ]
        },
        "tableName": "Table1"
      },
      "credentials": {
        "seaTableApi": {
          "id": "YBFwe7cXLQNGuChg",
          "name": "SeaTable account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "c0db351e-4c38-4f30-a532-71102834c3f4",
      "name": "更新行",
      "type": "n8n-nodes-base.seaTable",
      "position": [
        384,
        832
      ],
      "parameters": {
        "rowId": "={{ $json._id }}",
        "columnsUi": {
          "columnValues": [
            {
              "columnName": "email",
              "columnValue": "={{ $('contacts').item.json.email }}"
            },
            {
              "columnName": "firstname",
              "columnValue": "={{ $('contacts').item.json.firstname }}"
            },
            {
              "columnName": "lastname",
              "columnValue": "={{ $('contacts').item.json.lastname }}"
            },
            {
              "columnName": "company",
              "columnValue": "={{ $('contacts').item.json.company }}"
            }
          ]
        },
        "operation": "update",
        "tableName": "Table1"
      },
      "credentials": {
        "seaTableApi": {
          "id": "YBFwe7cXLQNGuChg",
          "name": "SeaTable account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6a21c5d9-a021-4c07-8f23-bbff08cdb5c1",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -736,
        1056
      ],
      "parameters": {
        "url": "=https://{{ $json.server }}/api-gateway/api/v2/dtables/{{ $json.base_uuid }}/tables",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"table_name\": \"contact\",\n  \"columns\": [\n    {\n      \"column_name\": \"email\",\n      \"column_type\": \"text\"\n    },\n        {\n      \"column_name\": \"firstname\",\n      \"column_type\": \"text\"\n    },\n        {\n      \"column_name\": \"lastname\",\n      \"column_type\": \"text\"\n    },\n        {\n      \"column_name\": \"company\",\n      \"column_type\": \"text\"\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            },
            {
              "name": "authorization",
              "value": "=Bearer {{ $json.access_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4d17f737-3b7e-46e4-9024-7648cc7ee4c7",
      "name": "联系人",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -512,
        640
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1877973285,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VPUd7xbigvW4dIjyvsSRn3Y3jpITjyZneCIEU0HK_Hw/edit#gid=1877973285",
          "cachedResultName": "contacts"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.googlesheetid }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0xG6VARJ6hnHx2T1",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "16a0a6b7-f105-4c8b-9ec0-c1472fee0630",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        -736,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4b74909d-6a40-422f-9d5a-1d72f5577f3f",
              "name": "googlesheetid",
              "type": "string",
              "value": "<put your Google Sheet ID here>"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8f0cbb8a-e570-4e8c-90c9-029326d69a5f",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        512
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 96,
        "content": "设置您要使用的 Google Sheet ID"
      },
      "typeVersion": 1
    },
    {
      "id": "a59171ae-873a-4c1d-9be6-7bd4a15be1a6",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        512
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 96,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2b104909-8608-4165-966b-7edf96b717e3",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 848,
        "content": "# 保持您的 Google Sheets 联系人与 SeaTable 同步"
      },
      "typeVersion": 1
    },
    {
      "id": "65ef3bb5-2721-4ca6-9860-45644d2fd8e0",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        864
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "content": "# 通过 API 创建表格"
      },
      "typeVersion": 1
    },
    {
      "id": "c74be35d-a5b6-48f9-89b0-3b13b198f813",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -960,
        1056
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1812dcee-b5af-46ab-aab4-4065e1026eb9",
              "name": "server",
              "type": "string",
              "value": "cloud.seatable.io"
            },
            {
              "id": "ee799561-c443-4fa2-aa4b-2123871bc982",
              "name": "base_uuid",
              "type": "string",
              "value": "<your base_uuid>"
            },
            {
              "id": "d6e5604f-1cbb-485c-9017-d44343369594",
              "name": "access_token",
              "type": "string",
              "value": "<your access token>"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7abce5a9-f386-4006-974f-76d2405bd97f",
      "name": "HTTP请求1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -928,
        288
      ],
      "parameters": {
        "url": "https://cloud.seatable.io/server-info",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e437af5a-6ba3-4dac-802c-37296987b67c",
      "name": "编辑字段2",
      "type": "n8n-nodes-base.set",
      "position": [
        -704,
        288
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "a2f3b7ca-c6df-4f4d-b701-6ca8b9029db2",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 288,
        "content": "# 获取服务器信息"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Create a row",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update a row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "contacts": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "settings": {
      "main": [
        [
          {
            "node": "contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replace Me": {
      "main": [
        []
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a row": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        []
      ]
    },
    "Update a row": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "seatablelookup": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Replace Me",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "seatablelookup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户关系管理, 多模态 AI

需要付费吗?

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

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

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

作者
Stéphane Heckel

Stéphane Heckel

@stephaneheckel

Data Sommelier | Sales Architect | Advisor | GTM

外部链接
在 n8n.io 查看

分享此工作流