AutomationFlowsData & Sheets › Aggregate Marketing Spend Data with Custom Pivots & Vlookups in Google Sheets

Aggregate Marketing Spend Data with Custom Pivots & Vlookups in Google Sheets

ByRobert Breen @rbreen on n8n.io

This workflow transforms raw marketing data from Google Sheets into a pivot-like summary table. It merges lookup data, groups spend by name, and appends the results into a clean reporting tab — all automatically, without needing to manually build pivot tables in Sheets.…

Event trigger★★★★☆ complexity10 nodesGoogle Sheets
Data & Sheets Trigger: Event Nodes: 10 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #8069 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5432b2ed-adde-4021-b6b3-e75e43bd102c",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1744,
        4816
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "20d77255-29ba-45aa-af1b-ff2b8ba91ef6",
      "name": "Clear sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -240,
        4944
      ],
      "parameters": {
        "operation": "clear",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1235077339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit#gid=1235077339",
          "cachedResultName": "render pivot"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit?usp=drivesdk",
          "cachedResultName": "Pivot Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "43298259-36ab-403d-91f8-0d0a499b6daf",
      "name": "Pivot",
      "type": "n8n-nodes-base.summarize",
      "position": [
        -464,
        5040
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Name",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Spend ($)",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ea502cf7-be4a-41ac-a1e0-38f73398c95e",
      "name": "Get Marketing Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1008,
        4944
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit#gid=0",
          "cachedResultName": "data"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit?usp=drivesdk",
          "cachedResultName": "Pivot Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "896e5698-f99a-4e1b-ad4c-f5c4c07e847e",
      "name": "Vlookup Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1280,
        5408
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 894339285,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit#gid=894339285",
          "cachedResultName": "Lookup"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit?usp=drivesdk",
          "cachedResultName": "Pivot Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "4178ff0a-9cbb-4eef-93d8-2a012471f0ed",
      "name": "Merge Tables (Vlookup)",
      "type": "n8n-nodes-base.merge",
      "position": [
        -688,
        5040
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "fieldsToMatchString": "Channel"
      },
      "typeVersion": 3.2
    },
    {
      "id": "3e622961-1081-40cd-870e-c3b0d114d3c0",
      "name": "Create \"Pivot Table\" Kindof",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -224,
        5152
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "sum_Spend_($)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sum_Spend_($)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1235077339,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit#gid=1235077339",
          "cachedResultName": "render pivot"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit?usp=drivesdk",
          "cachedResultName": "Pivot Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c007458e-07ec-4b25-b898-272ce0fcde8f",
      "name": "Sticky Note55",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        4608
      ],
      "parameters": {
        "color": 7,
        "width": 2144,
        "height": 1056,
        "content": "### Build a pivot-style marketing spend summary in Google Sheets using n8n (Merge + Summarize + Vlookup)\n\nThis workflow transforms raw marketing data from Google Sheets into a **pivot-like summary table**. It merges lookup data, groups spend by name, and appends the results into a clean reporting tab \u2014 all automatically, without needing to manually build pivot tables in Sheets.\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d004d740-9e2d-409a-b5df-960bd28482a7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2240,
        4608
      ],
      "parameters": {
        "width": 400,
        "height": 1056,
        "content": "\n## \ud83d\udd11 Setup Instructions\n\n### 1) Connect Google Sheets (OAuth2)\n1. In **n8n \u2192 Credentials \u2192 New \u2192 Google Sheets (OAuth2)**  \n2. Sign in with your Google account and grant access  \n3. In each Google Sheets node, select your **Spreadsheet** and the appropriate **Worksheet**:  \n   - **data** (raw spend)  \n   - **Lookup** (channel reference table)  \n   - **render pivot** (output tab)  \n\nhttps://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit?gid=894339285#gid=894339285\n\n## \ud83d\udcec Contact  \nNeed help customizing this (e.g., filtering by campaign, sending reports by email, or formatting your pivot)?  \n\n- \ud83d\udce7 **rbreen@ynteractive.com**  \n- \ud83d\udd17 **[Robert Breen](https://www.linkedin.com/in/robert-breen-29429625/)**  \n- \ud83c\udf10 **[ynteractive.com](https://ynteractive.com)**  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "2694e9b7-3405-4139-99bc-5ffd735f33a8",
      "name": "Sticky Note65",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        4880
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 656,
        "content": "### 1) Connect Google Sheets (OAuth2)\n1. In **n8n \u2192 Credentials \u2192 New \u2192 Google Sheets (OAuth2)**  \n2. Sign in with your Google account and grant access  \n3. In each Google Sheets node, select your **Spreadsheet** and the appropriate **Worksheet**:  \n   - **data** (raw spend)  \n   - **Lookup** (channel reference table)  \n   - **render pivot** (output tab)  \n\nhttps://docs.google.com/spreadsheets/d/1aO6fhd-P55lXy9QuKs23Eifi1SzZ2GAFj0q0Qx4vl30/edit?gid=894339285#gid=894339285\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Pivot": {
      "main": [
        [
          {
            "node": "Clear sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create \"Pivot Table\" Kindof",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vlookup Data": {
      "main": [
        [
          {
            "node": "Merge Tables (Vlookup)",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Marketing Data": {
      "main": [
        [
          {
            "node": "Merge Tables (Vlookup)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Tables (Vlookup)": {
      "main": [
        [
          {
            "node": "Pivot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Marketing Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Vlookup Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow transforms raw marketing data from Google Sheets into a pivot-like summary table. It merges lookup data, groups spend by name, and appends the results into a clean reporting tab — all automatically, without needing to manually build pivot tables in Sheets.…

Source: https://n8n.io/workflows/8069/ — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

This template is ideal for solo store owners, eCommerce marketers, automation beginners, or anyone using Shopify and Gmail who wants to recover lost revenue without coding.

HTTP Request, Gmail, Twilio +3
Data & Sheets

PCN. Uses googleSheets, httpRequest, @n-octo-n/n8n-nodes-json-database, itemLists. Event-driven trigger; 60 nodes.

Google Sheets, HTTP Request, @N Octo N/N8N Nodes Json Database +3
Data & Sheets

The workflow automates the process of gathering extensive keyword data for a "Main Keyword." It starts by reading initial parameters from a Google Sheets template, creates a new dedicated Google Sheet

Google Sheets, Google Drive, HTTP Request
Data & Sheets

🔥 March Sale – n8n Community Members Get ideoGener8r for Just $27! (Reg. $47) Use Coupon Code: (Valid until 3/31/2025 for n8n community members)

HTTP Request, Google Drive, Google Sheets
Data & Sheets

📄 Documentation: Notion Guide

Google Sheets, Google Drive, HTTP Request +2