Use this powerful n8n workflow to ingest Google Sheets data into a Supabase vector store using OpenAI embeddings, then query it using a Gemini-powered n8n agent for rapid RAG functionality.
Download this n8n workflow template and start using it instantly.
• Users needing knowledge retrieval from proprietary data.
• Developers building custom Retrieval-Augmented Generation (RAG) systems using n8n templates.
• Businesses automating personalized data lookups and requiring chat-based access.
• n8n specialists seeking advanced agent and vector database implementation examples.
This comprehensive n8n workflow addresses the challenge of creating a searchable, proprietary knowledge base from structured data sources like Google Sheets. It leverages the power of embedding models (OpenAI) and modern database technology (Supabase) to transform raw data into a dense vector index. This specific n8n workflow is designed in two critical stages: initialization (loading data) and execution (answering chat queries). Once indexed, a sophisticated n8n agent, powered by the Google Gemini Chat Model and utilizing Postgres for memory, can accurately retrieve and answer questions based on the stored personal information. This highly modular n8n template provides robust data integration and advanced AI functionality, showcasing complex Langchain integrations within n8n.
Part 1: Data Ingestion (Vector Store Creation)
The initialization phase of this n8n workflow is designed to run separately to build the vector index. The process begins by using the Google Sheets n8n node (Get row(s) in sheet1) to fetch all relevant personal data rows from a designated sheet. This tabular data is then converted into a structured file format by the Convert to File n8n node. The Default Data Loader prepares this content for vectorization using a CSV loader configuration. The Embeddings OpenAI n8n node generates high-quality vector embeddings. Finally, these resulting documents and their embeddings are inserted into the personal_data table within Supabase via the Vector Store n8n node, completing the data load process for this powerful n8n workflow.
Part 2: AI Agent Retrieval
The active part of the n8n workflow starts with the When chat message received n8n trigger, initiating the automation upon receiving a user query. The query is passed to the core AI Agent n8n node. This agent relies on several components to formulate its response:
Google Gemini Chat Model provides the reasoning capabilities.Postgres Chat Memory ensures the conversation context is maintained across multiple messages.Supabase Vector Store n8n node, configured specifically for retrieval (as a tool), allows the agent to search the vector index when the user's question requires personal data lookup. The agent uses the relevant personal data retrieved by this tool to synthesize an accurate answer, completing the query for this n8n template.documentId and sheetName parameters point to the source spreadsheet containing your personal data.personaldata table is set up to handle vector embeddings (Postgres with pgvector).Embeddings OpenAI) and during the retrieval phase (Embeddings OpenAI1) for vector matching. A valid API key is required.Get row(s) in sheet1 to Vector Store) once manually to populate your Supabase vector store before activating the Agent path (triggered by the chat n8n trigger).This n8n workflow uses a combination of standard data manipulation nodes and specialized Langchain-based n8n nodes:
When chat message received (n8n trigger): The starting point for the agent flow, waiting for an incoming chat query to execute the n8n workflow logic.
Get row(s) in sheet1 (Google Sheets n8n node): Fetches all rows from the specified 'Personal Birthday' Google Sheet, providing the raw data source for the n8n workflow.
Convert to File (n8n node): Converts the spreadsheet row data into a binary file format, which is essential input for the subsequent document loader.
Default Data Loader2 (Langchain n8n node): Loads the converted file data using the CSV loader to prepare the documents for embedding.
Embeddings OpenAI (Langchain n8n node): Uses OpenAI services to calculate vector embeddings for the documents destined for insertion into the vector store. This is a critical step in the n8n vectorization process.
Vector Store (Supabase Vector Store n8n node - Insert Mode): This node inserts the documents and their OpenAI embeddings into the Supabase personaldata table, building the vector index.
Google Gemini Chat Model (Langchain n8n node): Serves as the primary Language Model for the AI Agent n8n node, handling complex reasoning and response generation.
Postgres Chat Memory (Langchain n8n node): Stores the ongoing conversation history, allowing the AI Agent to maintain context within this n8n workflow.
Supabase Vector Store (Langchain n8n node - Retrieve Mode): Configured as a tool named 'Personal details table,' this node allows the AI Agent to search the vector index using the query name matchpersonal_data to retrieve factual information.
AI Agent (Langchain n8n node): The core control n8n node, orchestrating the LLM, Memory, and the Supabase Vector Store retrieval tool to answer user questions based on the vectorized knowledge base.
Use this robust n8n workflow to automatically convert a folder full of Google Drive images (PNG, JPG) into a single, high-quality PDF using Google Slides for layout and conversion. Get this n8n template now.

Use this efficient n8n workflow template to convert incoming HTML strings into professional, customized PDF documents instantly via a self-hosted Gotenberg service. A key n8n automation for document management.

Use this n8n workflow to create an OpenAI-compatible API endpoint that proxies requests to GitHub's free AI models, enabling their use within standard n8n AI agent configurations.

Use this powerful n8n workflow to transcribe voice notes and summarize text messages sent via Telegram using local AI models like LLaMA via Ollama. Secure and private note-taking.

Use this powerful n8n workflow to automate B2B cold outreach. It combines Google Sheets data, Tavily AI research, and LLMs (OpenRouter) to generate hyper-personalized email bodies, ready for Instantly.ai campaigns. This complete n8n templates solution streamlines sales outreach.


With 20+ years in marketing, I’ve worked as a developer and manager, leading teams and building innovative solutions. My expertise includes data engineering, designing native architectures on Google and AWS cloud, and integrating APIs to optimize workflows. I specialize in developing custom APIs and leveraging data to drive business efficiency, making impactful, data-driven decisions for organizations.







































