πŸ” Index Google Drive files into a Supabase vector store with OpenAI embeddings

⚑ 1,882 views Β· πŸ” AI RAG & Knowledge Retrieval

Description

πŸ“Ί Full walkthrough video: https://youtu.be/r5kN_la0O7I

Author: Cole Medin

Who it’s for

This workflow is for developers, data engineers, and knowledge management teams who need to automatically ingest documents stored in Google Drive into a searchable vector database β€” supporting RAG (retrieval-augmented generation) pipelines or semantic search applications.

How it works

  1. One-time setup: A chat trigger runs SQL queries to create the required Postgres tables (documents, document_metadata, document_rows) and the vector similarity match function in Supabase/Postgres.
  2. Trigger: Two Google Drive triggers detect newly created or updated files in a watched folder and pass them into a batch loop.
  3. Clean old data: For each file, stale document rows and vector embeddings are deleted from Supabase before re-processing.
  4. Metadata upsert & download: Document metadata (ID, title, URL) is upserted into Postgres, then the file binary is downloaded from Google Drive.
  5. Route by file type: A Switch node directs each file to the correct extractor β€” PDF, Word/Office document, Excel spreadsheet, or CSV.
  6. Tabular data storage: Excel and CSV rows are inserted as raw JSONB records into Postgres and aggregated into a summary.
  7. Embedding & storage: All extracted text (documents, PDFs, tabular summaries) is chunked with a character text splitter, embedded via OpenAI, and inserted into the Supabase vector store.

How to set up

Requirements

How to customize

πŸ”— Nodes Used

Postgres, Google Drive, Google Drive Trigger, Supabase, Embeddings OpenAI, Character Text Splitter

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup