8
n8n 中文网amn8n.com

使用 n8n 在 Google Sheets 中创建自动数据透视表

中级

这是一个自动化工作流,包含 12 个节点。主要使用 Summarize, GoogleSheets, ManualTrigger 等节点。 使用 n8n 在 Google Sheets 中创建自动数据透视表

前置要求
  • Google Sheets API 凭证

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "07bc087a-adc5-4094-8236-bf3c90dfc7db",
      "name": "启动工作流",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1088,
        976
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d9c83a60-1d84-4c57-a331-fff2f60bdddc",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        784
      ],
      "parameters": {
        "width": 540,
        "height": 848,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "7bcd7fa0-c6ef-453d-85a1-e7dd51785e2e",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        1024
      ],
      "parameters": {
        "color": 7,
        "width": 684,
        "height": 400,
        "content": "### 聚合和合并数据"
      },
      "typeVersion": 1
    },
    {
      "id": "b26723ad-8a5e-4b7c-b616-5d30cc4a359a",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        1216
      ],
      "parameters": {
        "color": 3,
        "width": 448,
        "height": 384,
        "content": "### 1. 准备您的 Google Sheet"
      },
      "typeVersion": 1
    },
    {
      "id": "1c9b0c94-9256-4afe-b852-03ba2201d651",
      "name": "汇总活动1",
      "type": "n8n-nodes-base.summarize",
      "position": [
        -464,
        1088
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Campaign",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Spend ($)",
              "aggregation": "sum"
            },
            {
              "field": "Clicks",
              "aggregation": "sum"
            },
            {
              "field": "Conversions",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "48415cdd-5bd3-4fbd-ba44-0b873c7056f5",
      "name": "汇总渠道1",
      "type": "n8n-nodes-base.summarize",
      "position": [
        -464,
        1248
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Channel",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Spend ($)",
              "aggregation": "sum"
            },
            {
              "field": "Clicks",
              "aggregation": "sum"
            },
            {
              "field": "Conversions",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "1c122f43-0f9e-4100-92bc-93ae78985625",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        784
      ],
      "parameters": {
        "color": 7,
        "width": 1436,
        "height": 848,
        "content": "## 📊 使用 n8n 在 Google Sheets 中创建自动数据透视表"
      },
      "typeVersion": 1
    },
    {
      "id": "f5a176e6-0ee9-41b5-beee-0e2b930ccd73",
      "name": "从 Google 获取数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -896,
        1456
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 365710158,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit#gid=365710158",
          "cachedResultName": "Data"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data - n8n"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "523a8a2b-9bdf-4afd-9361-6c41f88a8616",
      "name": "清空活动表1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -832,
        848
      ],
      "parameters": {
        "operation": "clear",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 505010778,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit#gid=505010778",
          "cachedResultName": "Campaign Pivot"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data - Pivot Tables"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "7fd3cee0-0318-428c-a8ce-c3a952cb46b8",
      "name": "清空渠道表",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -816,
        1040
      ],
      "parameters": {
        "operation": "clear",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 335973986,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit#gid=335973986",
          "cachedResultName": "Channel Pivot"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data - Pivot Tables"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "80f4d3ff-f6dd-4a5f-92e5-bf3c5cb36ee6",
      "name": "创建活动数据透视表",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -208,
        1072
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "sum_Spend_($)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sum_Spend_($)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sum_Clicks",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sum_Clicks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sum_Conversions",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sum_Conversions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Campaign",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Campaign",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 505010778,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit#gid=505010778",
          "cachedResultName": "Campaign Pivot"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data - Pivot Tables"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ca072d34-43b2-4df0-9e38-dc1453268fe9",
      "name": "创建渠道数据透视表",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -224,
        1264
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "sum_Spend_($)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sum_Spend_($)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sum_Clicks",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sum_Clicks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sum_Conversions",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sum_Conversions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Channel",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 335973986,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit#gid=335973986",
          "cachedResultName": "Channel Pivot"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lUEY6kPQbXizbmszLLNUJ_pBfGIKd75hu4uHj0vGRZQ/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data - Pivot Tables"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    }
  ],
  "pinData": {},
  "connections": {
    "Sum Channels1": {
      "main": [
        [
          {
            "node": "Create Channel Pivot Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Get Data From Google",
            "type": "main",
            "index": 0
          },
          {
            "node": "Clear Campaign Sheet1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Clear Channel Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sum Campaigns1": {
      "main": [
        [
          {
            "node": "Create Campaign Pivot Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Data From Google": {
      "main": [
        [
          {
            "node": "Sum Campaigns1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Sum Channels1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级

需要付费吗?

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

工作流信息
难度等级
中级
节点数量12
分类-
节点类型4
难度说明

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

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 查看

分享此工作流