🔬 Natural language Google Sheets data analysis with Gemini AI

⚡ 1,753 views · 🔬 Document Extraction & Analysis

💡 Pro Tip — HTTP Request scraping tends to break when sites update their markup. If you’re scraping a major platform, check if ScraperNode covers it — it has maintained scrapers for LinkedIn, Instagram, TikTok, YouTube, and 20+ other platforms that return structured data.

View All Scrapers

Description

This n8n workflow template creates an efficient data analysis system that uses Google Gemini AI to interpret user questions about spreadsheet data and processes them through a specialized sub-workflow for optimized token usage and faster responses.

What This Workflow Does

Tools Used

đź“‹ MAIN WORKFLOW - Query Parser

What This Workflow Does

The main workflow receives natural language questions from users and converts them into structured parameters that the sub-workflow can process. It uses Google Gemini AI to understand the intent and extract the necessary information.

Prerequisites for Main Workflow

Main Workflow Setup Instructions

1. Import the Main Workflow

  1. Copy the main workflow JSON provided
  2. In your n8n instance, go to Workflows → Import from JSON
  3. Paste the JSON and click Import
  4. Save with name: “Gemini Data Query Parser”

2. Set Up Google Gemini Connection

  1. Go to Google AI Studio
  2. Sign in with your Google account
  3. Go to Get API Key section
  4. Create a new API key or use an existing one
  5. Copy the API key

Configure in n8n:

  1. Click on Google Gemini Chat Model node
  2. Click Create New Credential
  3. Select Google PaLM API
  4. Paste your API key
  5. Save the credential

3. Set Up Google Sheets Connection for Main Workflow

  1. Go to Google Cloud Console
  2. Create a new project or select existing one
  3. Enable the Google Sheets API
  4. Create OAuth 2.0 Client ID credentials
  5. In n8n, click on Get Column Info node
  6. Create Google Sheets OAuth2 API credential
  7. Complete OAuth flow

4. Configure Your Data Source

Option A: Use Sample Data

Option B: Use Your Own Sheet

  1. Update Get Column Info node with your Sheet ID
  2. Ensure you have a “Columns” sheet for metadata
  3. Update sheet references as needed

5. Set Up Workflow Trigger

  1. Configure how you want to trigger this workflow (webhook, manual, etc.)
  2. The workflow will output structured JSON for the sub-workflow

⚙️ SUB-WORKFLOW - Data Processor

What This Workflow Does

The sub-workflow receives structured parameters from the main workflow and performs the actual data calculations. It handles fetching data, routing to appropriate aggregation methods, and formatting results.

Sub-Workflow Setup Instructions

1. Import the Sub-Workflow

  1. Create a new workflow in n8n
  2. Copy the sub-workflow JSON (embedded in the Execute Workflow node)
  3. Import as a separate workflow
  4. Save with name: “Data Processing Sub-Workflow”

2. Configure Google Sheets Connection for Sub-Workflow

  1. Apply the same Google Sheets OAuth2 credential you created for the main workflow
  2. Update the Get Data node with your Sheet ID
  3. Ensure it points to your data sheet (e.g., “Data” sheet)

3. Configure Google Gemini for Output Formatting

  1. Apply the same Gemini API credential to the Google Gemini Chat Model1 node
  2. This handles final result formatting
  1. In the main workflow, find the Execute Workflow - Summarize Data node
  2. Update the workflow reference to point to your sub-workflow
  3. Ensure the sub-workflow is set to accept execution from other workflows

Sub-Workflow Components

Example Usage

Once both workflows are set up, you can ask questions like:

Overall Metrics:

Single Dimension:

Two Dimensions:

Data Flow Between Workflows

  1. Main Workflow: User question → Gemini AI → Structured JSON output
  2. Sub-Workflow: Receives JSON → Fetches data → Performs calculations → Returns formatted table

Contact Information

For support, customization, or questions about this template:

Need help implementing these workflows, want to remove limitations, or require custom modifications? Reach out for professional n8n automation services and AI integration support.

đź”— Nodes Used

Google Sheets, Execute Sub-workflow, Execute Workflow Trigger, AI Agent, Simple Memory, Structured Output Parser

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup