Google Drive to Supabase RAG Vector Store Creation using Gemini - n8n Workflow

Create a powerful RAG vector database. This n8n workflow ingests Google Drive documents, uses Gemini for embeddings, and stores results in Supabase. Essential n8n templates for AI data pipelines.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • RAG developers looking for robust ingestion pipelines.

  • Data engineers needing to rapidly provision vector databases from cloud storage.

  • Users leveraging the power of the n8n node ecosystem for AI infrastructure.

  • Anyone seeking pre-built n8n templates for generative AI applications.

Overview

This specialized n8n workflow provides a complete, scalable solution for transforming unstructured document data from Google Drive into a structured vector database suitable for Retrieval-Augmented Generation (RAG). By automating the crucial steps—document loading, text extraction, embedding generation (via Google Gemini), and final storage in Supabase (Postgres with pgvector)—this n8n automation eliminates manual data preparation. This sophisticated n8n template demonstrates advanced integration between cloud services (Drive), AI providers (Gemini), and managed databases (Supabase), providing a ready-to-use n8n workflow for building high-quality AI knowledge bases quickly and efficiently.

How it Works

The entire process is managed efficiently within a single n8n workflow structure:


  1. Trigger and ID Extraction: The process begins with the When Executed by Another Workflow n8n trigger node, which accepts a Google Drive folder link as input. A subsequent Code in JavaScript n8n node then parses this URL using regex to reliably extract the necessary folder ID for Google Drive API interactions.

  2. Database Initialization: The Execute a SQL query n8n node connects to Supabase (Postgres) to initialize the vector store environment. This step is critical: it drops any existing documents table to ensure a clean slate, installs the pgvector extension, and defines the crucial match_documents SQL function used for vector similarity search.

  3. File Retrieval & Iteration: The Google Drive n8n node searches for and retrieves a list of all files found within the specified Drive folder using the extracted folder ID. The Loop Over Items n8n node ensures that each document is processed sequentially.

  4. Data Processing: Inside the loop, another Google Drive n8n node downloads the file content. For document types (like Google Docs), it uses file conversion options to extract the content as plain text. The Default Data Loader n8n node then standardizes this content for embedding.

  5. Embedding and Storage: The core RAG step is executed by the Insert into Supabase Vectorstore n8n node. This node utilizes the globally connected Embeddings Google Gemini n8n node to convert the document text into 768-dimensional vectors. It then handles the efficient bulk insertion of the document content, metadata, and the new embedding vectors directly into the designated Supabase documents table, completing the knowledge ingestion n8n workflow.

Installation Guide

To deploy and run this powerful n8n workflow, you need to configure the following credentials:


  1. Import the n8n Workflow: Import the provided JSON file into your n8n instance to get started with this n8n template.

  2. Google Drive OAuth2: Configure the Google Drive OAuth2 credential for the Search files and folders and Download File n8n node operations. Ensure the associated account has read access to the target folder.

  3. Postgres/Supabase Credential: Set up the Postgres credential for the Execute a SQL query n8n node, pointing it to your Supabase project connection string and database details.

  4. Google Gemini API Key: Configure the Google Palm/Gemini API key credential for the Embeddings Google Gemini4 n8n node. This is vital for generating the high-quality vector embeddings.

  5. Execution: This n8n workflow is designed as a callable action, activated by passing a JSON payload containing the required DriveFolderlink URL.

Node Details

When Executed by Another Workflow (n8n trigger): Serves as the primary execution trigger, expecting a JSON input payload containing the DriveFolderlink to the source material.
Execute a SQL query (Postgres n8n node): Responsible for the critical database provisioning step. It connects to Supabase, drops the existing RAG table (for idempotency), installs pgvector, and defines the necessary semantic similarity search function (match_documents).
Search files and folders (Google Drive n8n node): Retrieves the comprehensive list of all source documents within the Google Drive folder that require embedding.
Download File (Google Drive n8n node): Downloads the content of each file sequentially, utilizing built-in options to convert proprietary Google document formats (like Google Docs) into extractable plain text for processing.
Embeddings Google Gemini4 (LangChain n8n node): Provides the embedding service backbone for this n8n workflow, generating 768-dimension vectors for RAG using the Google Gemini model. This connection enables the vectorization step.
Insert into Supabase Vectorstore (LangChain n8n node): The final action n8n node. It orchestrates the entire RAG pipeline, using the document loader and the Gemini embedding model to calculate the vectors and store the document chunks and embeddings into the documents table in Supabase. This specific n8n node handles the complex vector storage logic seamlessly.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

Al Automation Expert || Al Agents || n8n || Python || LangChain || Helping businesses scale revenue and reduce costs with Al driven automation .

Featured*