8
n8n 中文网amn8n.com

在Google Sheets电子表格中追加、查找、更新和读取数据

中级

这是一个Building Blocks领域的自动化工作流,包含 7 个节点。主要使用 Set, GoogleSheets, ManualTrigger 等节点。 在Google Sheets中转换数据

前置要求
  • Google Sheets API 凭证

使用的节点 (7)

工作流预览
可视化展示节点连接关系,支持缩放和平移

无法加载工作流预览

导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "5",
  "name": "在 Google Sheets 电子表格中追加、查找、更新和读取数据",
  "nodes": [
    {
      "name": "点击“执行”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        450,
        450
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Google Sheets2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1450,
        450
      ],
      "parameters": {
        "key": "ID",
        "range": "A:D",
        "options": {
          "valueInputMode": "USER_ENTERED",
          "valueRenderMode": "UNFORMATTED_VALUE"
        },
        "sheetId": "1remFwo--5ehUgIU7UUndKldPI0Xm93e1T3DldD9GOg0",
        "operation": "update",
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleSheetsOAuth2Api": "google-sheet"
      },
      "typeVersion": 1
    },
    {
      "name": "集合1",
      "type": "n8n-nodes-base.set",
      "position": [
        1250,
        450
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "Rent",
              "value": "={{$node[\"Google Sheets1\"].json[\"Rent\"]+100}}"
            },
            {
              "name": "ID",
              "value": "={{$node[\"Google Sheets1\"].json[\"ID\"]}}"
            }
          ],
          "string": [
            {
              "name": "Name",
              "value": "={{$node[\"Google Sheets1\"].json[\"Name\"]}}"
            },
            {
              "name": "City",
              "value": "={{$node[\"Google Sheets1\"].json[\"City\"]}}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1050,
        450
      ],
      "parameters": {
        "range": "A:D",
        "options": {
          "valueRenderMode": "UNFORMATTED_VALUE",
          "returnAllMatches": true
        },
        "sheetId": "1remFwo--5ehUgIU7UUndKldPI0Xm93e1T3DldD9GOg0",
        "operation": "lookup",
        "lookupValue": "Berlin",
        "lookupColumn": "City",
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleSheetsOAuth2Api": "google-sheet"
      },
      "typeVersion": 1
    },
    {
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        850,
        450
      ],
      "parameters": {
        "range": "A:D",
        "options": {
          "valueInputMode": "USER_ENTERED"
        },
        "sheetId": "1remFwo--5ehUgIU7UUndKldPI0Xm93e1T3DldD9GOg0",
        "operation": "append",
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleSheetsOAuth2Api": "google-sheet"
      },
      "typeVersion": 1
    },
    {
      "name": "Google Sheets3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1650,
        450
      ],
      "parameters": {
        "range": "A:D",
        "options": {
          "valueRenderMode": "FORMATTED_VALUE"
        },
        "sheetId": "1remFwo--5ehUgIU7UUndKldPI0Xm93e1T3DldD9GOg0",
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleSheetsOAuth2Api": "google-sheet"
      },
      "typeVersion": 1
    },
    {
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        650,
        450
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "ID",
              "value": "={{Math.floor(Math.random()*1000)}}"
            }
          ],
          "string": [
            {
              "name": "Name",
              "value": "John's Place"
            },
            {
              "name": "Rent",
              "value": "$1,000"
            },
            {
              "name": "City",
              "value": "Berlin"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {},
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set1": {
      "main": [
        [
          {
            "node": "Google Sheets2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "Set1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets2": {
      "main": [
        [
          {
            "node": "Google Sheets3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 构建模块

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流