Automated Data Analysis, Filtering, and AI-Driven Summary using Google Sheets - n8n Workflow

Use this comprehensive n8n workflow to merge Google Sheets data, apply complex filters, calculate performance by leader, and generate an insightful AI summary using the OpenAI n8n node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Marketing Analysts who need automated performance reporting.
Data professionals seeking powerful, customizable n8n templates for ETL processes.
Users who want to combine core logic flow control with advanced AI analysis within a single n8n workflow.
Anyone looking to integrate Google Sheets operations with the OpenAI n8n node.

Overview

This expert n8n workflow automates a detailed data analysis pipeline, transforming raw marketing metrics from Google Sheets into actionable, narrative insights. It solves the challenge of manually cross-referencing disparate datasets and applying complex segmentation logic. The process starts by merging two Google Sheets—one for metrics and one for leader assignments—using a common key. Data is then filtered and categorized based on performance thresholds (Clicks and Spend). The n8n node configuration aggregates these segmented outcomes by leader. Critically, the final stage uses an AI Agent powered by GPT-4o-mini to analyze the aggregated data table and produce a natural language summary, identifying the best and worst performers. This robust n8n workflow serves as an excellent template for data scientists and analysts leveraging the full power of n8n for data management and interpretation.

How it Works

The execution of this comprehensive n8n workflow follows a nine-step logical progression:


  1. Extraction (n8n trigger): The Start Workflow manual n8n trigger initiates the process, immediately fetching data concurrently from two separate Google Sheets (Marketing Data and Leader Assignment).

  2. Merging Data: The Merge on Channel Field n8n node combines the two input streams based on the common 'Channel' identifier.

  3. Initial Filtering: The Filter n8n node keeps only records where Clicks are greater than or equal to 5, ensuring analysis focuses on active campaigns.

  4. Conditional Branching: The Check if spend over $350 If n8n node splits the data flow. The 'True' path processes data points where Spend is high (>= $350), labeling them 'Great' days, while the 'False' path processes 'Poor' days.

  5. Aggregation: Within both branches, the Summarize n8n node calculates the total count of days (rows) for each distinct Leader.

  6. Data Labeling: Set n8n node instances apply the appropriate Outcome label ('Great' or 'Poor') and format the count into the # of Days column.

  7. Consolidation: The Append datasources together n8n node merges the two labeled branches back into a single, unified dataset.

  8. AI Preparation: A Code n8n node converts the consolidated JSON list into a single block of readable text, optimized for the AI Agent’s prompt input.

  9. AI Analysis and Summary: The AI Agent - Summarize Leader Performance n8n node, linked to the OpenAI Chat Model, uses the prepared text to generate a comprehensive, structured paragraph summary of the leader performances. This powerful n8n node combination delivers the final analytical output.

Installation Guide

To deploy this analysis n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON and import it directly into your n8n instance.

  2. Google Sheets Setup: You must first copy the sample Google Sheet provided in the sticky note instructions.

  3. Google Sheets Credential: Create a new Google Sheets OAuth2 API credential in n8n and authorize access to the copied spreadsheet for both Google Sheets n8n node instances.

  4. OpenAI Credential: In the OpenAI Chat Model n8n node, set up or select an existing OpenAI API Key credential to enable the AI Agent functionality. This ensures the complex summarization runs correctly within the n8n workflow.

Node Details

Start Workflow (n8n trigger): Acts as the entry point, manually initiating the execution of the n8n workflow.
Google Sheets (n8n node): Used twice to extract raw marketing data and leader assignments from the specified spreadsheet IDs and sheet names.
Merge on Channel Field (n8n node): A core logic node that combines two datasets using the 'Channel' field as the common merge key.
Filter (n8n node): Filters data, retaining items where Clicks meet or exceed 5.
Check if spend over $350 (If n8n node): Implements conditional flow control, directing high-spend records down the 'Great' path.
Summarize (n8n node): Aggregates the number of days (rows) grouped by the Leader field in both performance branches.
Set (n8n node): Transforms the aggregated data, explicitly setting the Outcome label ('Great' or 'Poor') and mapping the count to a descriptive field name.
Convert table names and columns into single text for agent (Code n8n node): A custom n8n node using JavaScript to serialize the aggregated JSON items into a single, plain text input suitable for the AI model.


  • AI Agent - Summarize Leader Performance (n8n node): The primary analytical n8n node. It uses a defined system message and the formatted text input, alongside the OpenAI Chat Model (GPT-4o-mini), to generate the final performance summary report.

Related n8n Workflows

Free

Nodes: 12 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*