8
n8n 中文网amn8n.com

从Google电子表格自动化n8n用户邀请

中级

这是一个IT Ops领域的自动化工作流,包含 11 个节点。主要使用 Set, Code, Merge, HttpRequest, GoogleSheets 等节点。 从Google电子表格自动化n8n用户邀请

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e634e668fe1fc93a75c4f2a7fc0dad807ca318b79654157eadb9578496acbc76",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "58c6003f-3311-448b-a949-4fbc22b38e2e",
      "name": "点击“测试工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -560,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "67e4f66c-256f-4e45-b98e-d2872a416ff5",
      "name": "获取所有用户",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        80,
        100
      ],
      "parameters": {
        "url": "={{ $json.n8n_url }}",
        "options": {
          "pagination": {
            "pagination": {
              "parameters": {
                "parameters": [
                  {
                    "name": "cursor",
                    "value": "={{ $response.body.nextCursor }}"
                  }
                ]
              },
              "completeExpression": "={{ !$response.body.nextCursor }}",
              "paginationCompleteWhen": "other"
            }
          }
        },
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "limit",
              "value": "5"
            }
          ]
        },
        "nodeCredentialType": "n8nApi"
      },
      "credentials": {
        "n8nApi": {
          "id": "dzYjDgtEXtpRPKhe",
          "name": "n8n account"
        },
        "httpHeaderAuth": {
          "id": "iiLmD473RYjGLbCA",
          "name": "Squarespace API key - Apps script"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2a66ddc7-5fde-4e2b-9ad6-7c68968214ae",
      "name": "获取所有行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        80,
        -180
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/15A3ZWzIBfONL4U_1XGJvtsS8HtMQ69qrpxd5C5L6Akg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "15A3ZWzIBfONL4U_1XGJvtsS8HtMQ69qrpxd5C5L6Akg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/15A3ZWzIBfONL4U_1XGJvtsS8HtMQ69qrpxd5C5L6Akg/edit?usp=drivesdk",
          "cachedResultName": "n8n-submission"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JgI9maibw5DnBXRP",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "f220c6db-eafb-4bb5-9cbe-43edcf563a67",
      "name": "获取非用户",
      "type": "n8n-nodes-base.merge",
      "position": [
        620,
        -100
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "advanced": true,
        "joinMode": "keepNonMatches",
        "mergeByFields": {
          "values": [
            {
              "field1": "Email Address",
              "field2": "email"
            }
          ]
        },
        "outputDataFrom": "input1"
      },
      "typeVersion": 3
    },
    {
      "id": "906e8dde-4c58-4e93-9e07-3064a5dd60dd",
      "name": "邀请用户",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1100,
        -100
      ],
      "parameters": {
        "url": "={{ $('Edit Fields').item.json.n8n_url }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ [$json] }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "n8nApi"
      },
      "credentials": {
        "n8nApi": {
          "id": "dzYjDgtEXtpRPKhe",
          "name": "n8n account"
        },
        "httpHeaderAuth": {
          "id": "iiLmD473RYjGLbCA",
          "name": "Squarespace API key - Apps script"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "195d0c33-611a-4a16-b62c-8ba1f4f31e19",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -560,
        -160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dd453b5b-f238-43b1-8c44-2c3ed3a3d7ba",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -220,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c3a7a1ee-d1a2-4a29-b4b3-dcadf0fc16e2",
              "name": "n8n_url",
              "type": "string",
              "value": "https://{n8n-url}/api/v1/users"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "07e678c7-7c98-4f09-89d8-5e4d7d442a8f",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -160
      ],
      "parameters": {
        "color": 4,
        "width": 230,
        "height": 300,
        "content": "## 编辑此节点 👇"
      },
      "typeVersion": 1
    },
    {
      "id": "2bfb10b6-220b-4c73-a15f-190412f2dda2",
      "name": "创建用户列表",
      "type": "n8n-nodes-base.set",
      "position": [
        880,
        -100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "36282722-07ec-47b1-ab08-c649b7901ed7",
              "name": "email",
              "type": "string",
              "value": "={{ $json['Email Address'] }}"
            },
            {
              "id": "9b073e1d-8c16-45b1-b333-97dfe635eb73",
              "name": "role",
              "type": "string",
              "value": "global:member"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "221ca946-e305-4283-bca1-4289b8a7db28",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -300
      ],
      "parameters": {
        "color": 4,
        "width": 371.1995072042308,
        "height": 600.88409546716,
        "content": "## 从 Google Sheets 邀请用户到 n8n"
      },
      "typeVersion": 1
    },
    {
      "id": "c956e102-7fe3-4ee4-90e0-32cb11556c2c",
      "name": "合并所有分页结果",
      "type": "n8n-nodes-base.code",
      "position": [
        320,
        100
      ],
      "parameters": {
        "jsCode": "let results = [];\nfor (let i = 0; i < $input.all().length; i++) {\n  results = results.concat($input.all()[i].json.data);\n}\n\nreturn results;"
      },
      "typeVersion": 2
    }
  ],
  "pinData": {},
  "connections": {
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Get all rows",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get all Users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all rows": {
      "main": [
        [
          {
            "node": "Get non-users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all Users": {
      "main": [
        [
          {
            "node": "Combine all paginated results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get non-users": {
      "main": [
        [
          {
            "node": "Create users list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create users list": {
      "main": [
        [
          {
            "node": "Invite Users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine all paginated results": {
      "main": [
        [
          {
            "node": "Get non-users",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - IT 运维

需要付费吗?

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

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

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

作者
bangank36

bangank36

@bangank36

Automation specialist with 10+ years of experience helping SME website owners streamline their workflows—specializing in Squarespace, Shopify, and WordPress. Book an initial consultation for custom n8n automation using my link.

外部链接
在 n8n.io 查看

分享此工作流