Automatic Pivot Table Generation in Google Sheets - n8n Workflow

Automate the creation of real-time pivot tables in Google Sheets using this powerful n8n workflow. Perfect for reporting, summarizing large datasets, and advanced data analysis.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Marketing Analysts who need updated campaign performance summaries.
Data professionals managing large, frequently updated datasets in spreadsheets.
Users looking to leverage the n8n Summarize node for automated reporting.
Anyone seeking efficient n8n templates for complex Google Sheets operations.

Overview

This specialized n8n workflow addresses the challenge of manually generating pivot tables from frequently updated data sources. Manual pivoting is time-consuming and error-prone, especially when working with high-volume data like marketing campaign results. By using this n8n template, users can reliably extract raw data, clean existing reports, and instantly create two distinct pivot tables—one summarizing performance by Campaign and one by Channel. This ensures your key performance indicators (KPIs) are always calculated and ready for immediate consumption, eliminating tedious manual summarization steps and demonstrating the utility of the aggregation n8n node for robust data transformation within an automated n8n workflow.

How it Works

This efficient n8n workflow transforms raw spreadsheet data into structured pivot tables automatically:


  1. Workflow Initialization: The process starts with the manual n8n trigger, initiating the automation flow. This can easily be replaced by a Schedule n8n trigger for daily or hourly updates.

  2. Cleanup Phase: The workflow executes two parallel Google Sheets n8n node operations (Clear Campaign Sheet1 and Clear Channel Sheet) to clear all existing data from the dedicated pivot report tabs, ensuring that every run starts with a clean slate.

  3. Data Extraction: The Get Data From Google Google Sheets n8n node then retrieves all data rows from the primary 'Data' sheet, fetching the full raw dataset for processing.

  4. Data Pivoting (Campaign): The first Summarize n8n node (Sum Campaigns1) processes the extracted data, grouping items by the 'Campaign' field and calculating the sum of key metrics: 'Spend ($)', 'Clicks', and 'Conversions'.

  5. Data Pivoting (Channel): Simultaneously, a second Summarize n8n node (Sum Channels1) groups the raw data by the 'Channel' field, creating the basis for the second report.

  6. Output to Sheets: Two final Google Sheets n8n node actions then append this newly summarized data back into the respective 'Campaign Pivot' and 'Channel Pivot' sheets, finalizing the automated pivot tables. This complex data manipulation is handled seamlessly within a single n8n workflow.

Installation Guide

To deploy and use this n8n workflow template, follow these steps:


  1. Importing the n8n workflow: Copy the provided JSON data and import it directly into your n8n instance using the "New" -> "Import from JSON" option.

  2. Google Sheets Credentials Setup: You must set up a Google Sheets OAuth2 API credential. In n8n, navigate to "Credentials," select "Google Sheets OAuth2 API," and authorize access to your Google account. This credential is required for all Google Sheets n8n node operations.

  3. Sheet Preparation: Ensure your target Google spreadsheet is structured correctly. It must include:

A 'Data' tab with your raw campaign metrics (Row 1 headers).
Dedicated, empty tabs named 'Campaign Pivot' and 'Channel Pivot' ready to receive the summarized results.

  1. Configuration: Update the Document ID fields in all Google Sheets n8n node instances (Clear, Get Data, and Create Pivot Table nodes) to point accurately to your specific spreadsheet ID.

  2. Execution: Activate the n8n workflow. You can trigger it manually using the 'Start Workflow' n8n trigger or configure a schedule for automated execution.

Node Details

Start Workflow (n8n trigger): A manual n8n trigger used to initiate the data pipeline. Ideal for testing or quick report generation.
Google Sheets (Clear Campaign Sheet1 & Clear Channel Sheet): Function: Prepares the reporting tabs by clearing all previous data before new pivot data is inserted. Key Configuration: Operation set to clear.
Google Sheets (Get Data From Google): Function: Reads the raw marketing data from the designated 'Data' tab in the spreadsheet, pulling the necessary information into the n8n workflow for aggregation. Key Configuration: Operation set to getAll.
Summarize (Sum Campaigns1): Function: The primary aggregation n8n node. It groups the raw data by the Campaign field. Key Configuration: Fields to Summarize: Sum of Spend ($), Clicks, and Conversions.
Summarize (Sum Channels1): Function: Creates the secondary pivot view. This n8n node groups data based on the Channel field. Key Configuration: Fields to Summarize: Sum of Spend ($), Clicks, and Conversions.
Google Sheets (Create Campaign Pivot Table & Create Channel Pivot Table): Function: Writes the results of the Summarize n8n node operations back to the appropriate pivot tabs. Key Configuration: Operation set to appendOrUpdate.

Related n8n Workflows

Free

Nodes: 4 Nodes
Updated: December 26 2025
View all
Created by

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.

Featured*