Skip to main content

Keep RAG system updated with Google Drive file changes to Supabase vector DB

Workflow preview

Workflow preview
100%
Keep RAG system updated with Google Drive file changes to Supabase vector DB preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n workflow ensures data freshness in the RAG system by handling modifications to existing files. It complements the "Document Ingestion" workflow by triggering whenever a file in the monitor...

Best for

  • Document Extraction automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.set, n8n-nodes-base.supabase, n8n-nodes-base.googledrive, n8n-nodes-base.if, n8n-nodes-base.aggregate, n8n-nodes-base.summarize, n8n-nodes-base.extractfromfile, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by edisantosa.

Original n8n.io source

1.1 Workflow description

Title
Keep RAG system updated with Google Drive file changes to Supabase vector DB
Workflow name
Keep RAG system updated with Google Drive file changes to Supabase vector DB

This n8n workflow ensures data freshness in the RAG system by handling modifications to existing files. It complements the "Document Ingestion" workflow by triggering whenever a file in the monitored Google Drive folder is updated.

This "delete-then-re-insert" process ensures the RAG agent always has access to the most current version of your documents.

Key Features & Workflow:

Update Trigger: The workflow activates using the File Updated trigger for the same Google Drive folder ("DOCUMENTS").

Duplicate Run Prevention: An If node cleverly filters out immediate "update" events that are triggered by the "Upload Doc" workflow's Word-to-Google-Doc conversion, preventing unecessary duplicate runs.

Delete Old Entries: Once a genuine update is detected, the workflow's first action is to find and delete all existing vector chunks associated with that file_id from the Supabase "documents" table.

Smart Versioning: It then retrieves the old version number from the deleted metadata and uses an OpenAI node (Set Version) to intelligently increment it (e.g., "v1" becomes "v2").

Re-Ingestion Pipeline: The updated file is then processed through the exact same logic as the "Upload Doc" workflow:

It is routed by a Switch node based on its MIME type (PDF, Google Doc, Excel, etc.).

Text is extracted, chunked, and embedded.

The Enhanced Default Data Loader enriches these new chunks with metadata, including the new, incremented version number.

Insert New Entries: Finally, the newly processed and versioned chunks are inserted back into the Supabase Vector Store.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Set File ID

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 2 - Delete Old Doc Rows

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 3 - Download File

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 4 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 5 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 6 - Summarize

Type / Role
n8n-nodes-base.summarize - summarize
Config choices
Version 1

Block 7 - Extract PDF Text1

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 8 - Extract from Excel1

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 9 - Convert to Google Doc2

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 10 - Delete File1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 11 - Recursive Character Text Splitter1

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 12 - Embeddings OpenAI2

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.1

Block 13 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Enhanced Default Data Loader2

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 15 - Loop Over Items1

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 16 - File Updated

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 17 - Insert into Supabase Vectorstore

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1

Block 18 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3

Block 19 - Extract from Text File1

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 20 - Limit

Type / Role
n8n-nodes-base.limit - limit
Config choices
Version 1

Block 21 - Set Version

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.7

Block 22 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Keep RAG system updated with Google Drive file changes to Supabase vector DB
Complexity advanced
Nodes 22
Categories Document Extraction, AI RAG
Author edisantosa
Published 20 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9934/9934.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Keep RAG system updated with Google Drive file changes to Supabase vector DB do?

This n8n workflow ensures data freshness in the RAG system by handling modifications to existing files. It complements the "Document Ingestion" workflow by triggering whenever a file in the monitor...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI RAG use case.