Keyflow

Search Keyflow

Find a shortcut, workflow, MCP server or skill

Query Google Sheets/CSV data through an AI Agent using PostgreSQL

n8n template #3079
Want to see it in action? Watch the full breakdown here: 📺 Video Link Template Description This n8n workflow empowers you to query structured financial data from Google Sheets or CSV files using AI-generated SQL. Unlike traditional vector database solutions that falter with numerical queries, this template leverages PostgreSQL for efficient data storage and an AI agent to dynamically create optimized SQL queries from natural language inputs. What It Does Retrieves data from Google Sheets or CSV files Infers the data schema and builds a PostgreSQL table Populates the table with your data Uses an AI agent to translate natural language questions into SQL queries Returns precise numerical resul

How to set it up

  1. Open template #3079 on n8n.io and click Use for free, or copy the template JSON and paste it onto an empty canvas in n8n.
  2. Create 3 credentials under Credentials → Add credential: Google Sheets, Postgres, Google Gemini Chat Model. Then open each of those nodes and pick the credential.
  3. Check the model in the AI Agent node. The template may point at a model your account can't use; swap it for one you have access to.
  4. Click Execute workflow and step through each node's output to confirm the data looks right.
  5. Toggle the workflow to Active so its trigger runs on its own.

Hand off to your agent

Prompt

Help me set up the n8n workflow "Query Google Sheets/CSV data through an AI Agent using PostgreSQL" (https://n8n.io/workflows/3079). It uses: Google Sheets, Postgres, Code, AI Agent, Call n8n Workflow Tool, Google Gemini Chat Model. Import the template JSON into my n8n instance, list every credential I need to create, and walk me through testing it.

Paste into Claude Code and it will do the rest.

Apps and nodes

Questions

Yes. Leonardo Grigorio published it free on n8n.io as a verified creator, and it has 8,069 views. It runs on n8n Cloud or a self-hosted n8n instance.

Google Sheets, Postgres, Google Gemini Chat Model. The other 3 nodes are built into n8n.

Similar workflows

NameViews
  1. Explore n8n Nodes in a Visual Reference Library5,197
  2. Chat with a Google Sheet using AI50K
  3. ✨ Vision-Based AI Agent Scraper - with Google Sheets, ScrapingBee, and Gemini35K
  4. Customer Support WhatsApp Bot with Google Docs Knowledge Base and Gemini AI15K
  5. Build an AI-Powered Tech Radar Advisor with SQL DB, RAG, and Routing Agents12K
  6. AI-Powered Restaurant Order Chatbot with GPT-4o for POS Integration11K
  7. Lead Workflow: Yelp & Trustpilot Scraping + OpenAI Analysis via BrightData7,460
  8. Automate SEO blog content creation with GPT-4, Perplexity AI and WordPress6,949