Use this powerful n8n workflow to turn natural language questions into structured Google Sheets data queries. Featuring Gemini AI for query parsing and report generation.
Download this n8n workflow template and start using it instantly.
Analyzing large datasets in Google Sheets often requires manual effort or complex pivot tables. This advanced n8n workflow solves this problem by creating a conversation layer powered by Google's Gemini AI. The core value of this n8n automation is its ability to interpret ambiguous human language (e.g., "Show total Spend by Channel") and translate it into a precise, executable instruction set (column, aggregation, level). This ensures accurate data retrieval and aggregation using standard n8n node logic, followed by a final formatting step using Gemini AI to present the results cleanly. It’s an ideal example of how to leverage n8n to build sophisticated, AI-driven data tools, reducing friction for end-users and showcasing the power of n8n templates.
This n8n workflow operates in two main phases: Query Parsing (Main Workflow) and Data Processing (Sub-Workflow).
Talk to Data with Gemini n8n node (an AI Agent). This Agent uses the Google Gemini Chat Model and a Simple Memory n8n node for context retention.Get Column Info Google Sheets tool to dynamically inspect the data structure, ensuring it only generates queries based on actual column names in the sheet.Structured Output Parser n8n node forces the Gemini Agent to convert the natural language query into a strict JSON object specifying the target column, the required aggregation (sum, avg, countd, etc.), and the level of detail (level).Execute Workflow - Summarize Data n8n node.When Executed by Another Workflow n8n trigger, receiving the structured JSON query. It uses a Google Sheets n8n node (Get Data) to pull the necessary source data.Type of Aggregation Switch n8n node routes the data flow based on the aggregation type specified by the AI (e.g., if the aggregation is 'sum', it routes to the Sum node; if 'countd', to Count Unique).Summarize n8n node runs the aggregation logic (Sum, Average, Count Unique, Min, Max, Count), grouped by the specified level.Bring All Data together Aggregate n8n node collects the results from the successful aggregation branch.Write into Table Output AI Agent n8n node, which uses the Google Gemini Chat Model1 to re-format the data into a clean, human-readable table or summary before returning the final result.To deploy this comprehensive n8n workflow template, you must configure both Google Sheets and Google Gemini credentials.
Talk to Data with Gemini and Google Gemini Chat Model1 n8n node, click 'Create New Credential'.Get Column Info and Get Data n8n node, create a new 'Google Sheets OAuth2 API' credential and complete the authentication flow.Get Column Info and Get Data) point to your actual spreadsheet document ID and sheet names. The example uses a sheet named 'Data' and fetches column metadata from 'Columns'. When Executed by Another Workflow (n8n trigger): This node acts as the entry point for the sub-workflow, receiving the structured query parameters (column, aggregation, level) from the main n8n workflow.
Google Sheets Tool (Get Column Info): A crucial tool within the main n8n workflow's AI Agent. Its function is to provide the Gemini model with the exact schema (column names and types) of the Google Sheet data, ensuring the generated query is valid.
Google Gemini Chat Model / Agent (n8n node): Used as the backbone for the AI functionality. In the main workflow, it powers the Agent to interpret natural language and produce structured JSON. In the sub-workflow (Google Gemini Chat Model1), it is used for final result formatting.
Structured Output Parser (n8n node): Enforces a specific JSON format output from the AI Agent, standardizing the query for subsequent data processing n8n nodes.
Execute Workflow (n8n node): Passes the structured query parameters from the parsing phase to the dedicated data aggregation sub-workflow, enabling modular design for this complex n8n automation.
Google Sheets (Get Data) (n8n node): Fetches the necessary rows from the data sheet once the query is defined.
Switch (Type of Aggregation) (n8n node): A core logic n8n node that dynamically routes the data to the correct aggregation method (Sum, Average, Count Unique, etc.) based on the parameter determined by the AI Agent.
Summarize (n8n node): Multiple instances (Sum, Average, Min, Max, Count Unique, Count) execute the actual data aggregation and grouping based on the column and level passed from the initial query. These are essential processing steps in the n8n workflow.
Automate secure PostgreSQL database queries using natural language via a powerful dual-agent n8n workflow architecture. This n8n template handles voice/text input, converts it to safe SQL queries, and returns formatted results.

Automate fetching 7-day weather forecasts from the National Weather Service (NWS) and instantly deliver them to Slack using this robust n8n workflow. Implement custom APIs with simple n8n nodes.

Use this sophisticated n8n workflow to monitor news feeds, extract article content, run AI simulation analysis via AskRally, and trigger proactive Gmail alerts based on shifting market narratives. Automate threat detection today.

Use this sophisticated n8n workflow to create a Natural Language trading bot via Telegram, integrating GPT-4o for intent classification, position sizing, and automatic MT5 trade execution.

Use this advanced n8n workflow to manage Pipedrive CRM instantly via natural language commands sent through Telegram. Leverage the Google Gemini AI n8n node for intelligent, hands-free sales operations. A crucial n8n template for sales teams.

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.







































