workflows.fit
Back to n8n workflows
n8n templateFreeBy Robert Breen

Natural language to SQL converter for Google Sheets with GPT-4o

This n8n workflow template creates an intelligent data analysis system that converts natural language questions into Google Sheets SQL queries using OpenAI's GPT-4o model. The system generates proper Google Sheets que...

DevelopmentCore NodesAILangchainAgentGoogle Sheets ToolMemory Buffer WindowLm Chat Open Ai
Loading interactive preview...

Template notes

This n8n workflow template creates an intelligent data analysis system that converts natural language questions into Google Sheets SQL queries using OpenAI's GPT-4o model. The system generates proper Google Sheets query URLs and executes them via HTTP requests for efficient data retrieval.

What This Workflow Does

- Natural Language to SQL: Converts user questions into Google Sheets SQL syntax - Direct HTTP Queries: Bypasses API limits by using Google Sheets' built-in query functionality - Column Letter Mapping: Automatically maps column names to their corresponding letters (A, B, C, etc.) - Structured Query Generation: Outputs properly formatted Google Sheets query URLs - Real-time Data Access: Retrieves live data directly from Google Sheets - Memory Management: Maintains conversation context for follow-up questions

Tools Used

- OpenAI Chat Model (GPT-4o) - SQL query generation and natural language understanding - OpenAI Chat Model (GPT-4.1 Mini) - Result formatting and table output - Google Sheets Tool - Column metadata extraction and schema understanding - HTTP Request Node - Direct data retrieval via Google Sheets query API - Structured Output Parser - Formats AI responses into executable queries - Memory Buffer Window - Conversation history management - Chat Trigger - Webhook-based conversation interface

Step-by-Step Setup Instructions

1. Prerequisites

Before starting, ensure you have: - An n8n instance (cloud or self-hosted) - An OpenAI account with API access and billing setup - A Google account with access to Google Sheets - The target Google Sheet must be publicly accessible or shareable via link