Multi-Format Document Ingestion for RAG Systems - n8n Workflow

Use this robust n8n workflow to automatically process and ingest multi-format documents (PDF, Docx, Excel) from Google Drive into a Supabase Vectorstore using OpenAI embeddings, perfect for building custom RAG chatbots.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

AI Developers and Engineers needing to populate a vector database automatically.
Data specialists who handle diverse document types (Word, Excel, PDF).
Users looking for a production-ready n8n workflow to create a dynamic RAG knowledge base.
Anyone building custom chatbots powered by proprietary company data.

Overview

Building a reliable Retrieval-Augmented Generation (RAG) system requires clean, chunked, and vectorized data. This advanced n8n workflow solves the complex challenge of ingesting diverse file types directly from a monitored Google Drive folder.

Traditional systems struggle with proprietary formats like MS Word or complex layouts like Excel spreadsheets. This specific n8n template ensures robust handling: converting Word documents to plain text Google Docs, extracting data from PDFs, and summarizing Excel content before vectorization.

By leveraging the Google Drive Trigger n8n node, this automation acts as a continuous ingestion pipeline, generating high-quality text chunks using the Recursive Character Text Splitter and powerful embeddings via the OpenAI Embeddings n8n node. The final output is seamlessly inserted into Supabase, maintaining critical file metadata required for advanced RAG queries.

How it Works

This n8n workflow initiates every time a new file is uploaded to a specified Google Drive folder.


  1. File Detection (n8n trigger): The File Created n8n trigger node immediately captures details of any new file upload.

  2. Metadata Setting & Looping: The workflow captures the file ID and MIME type (Set File ID1). The Loop Over Items n8n node ensures batch processing compatibility.

  3. Format Normalization: A powerful Switch2 n8n node routes the data based on the MIME type:

If the file is a Word document (Docx, Doc), it routes to Convert to Google Doc1 (using a Google Drive API call) which converts the file to a native Google Doc for reliable text extraction, followed by deleting the original file using the Delete File n8n node.
PDF files go directly to the Extract PDF Text n8n node.
* Excel files are handled by the Extract from Excel n8n node, and the resulting tabular data is aggregated and summarized into a continuous text stream using the Aggregate1 and Summarize1 n8n node steps.

  1. Text Extraction: Documents normalized to Google Docs or standard text formats are extracted using Extract from Text File or Download File1.

  2. Metadata Addition: The Enhanced Default Data Loader1 n8n node enriches the raw text with vital metadata, including file name, creator, and ID.

  3. Chunking: The Recursive Character Text Splitter n8n node breaks the large document text into smaller, manageable chunks (2000 characters with 200 overlap), optimized for vector searches.

  4. Vectorization: The Embeddings OpenAI1 n8n node calls the OpenAI API to generate dense vector representations for each text chunk.

  5. Database Insertion: Finally, the Insert into Supabase Vectorstore1 n8n node securely stores the text chunks, metadata, and generated embeddings into the Supabase RAG table, completing the robust n8n workflow cycle.

Installation Guide

To deploy this comprehensive n8n template, follow these steps:


  1. Import: Copy the provided n8n workflow JSON and import it into your n8n instance.

  2. Credentials Setup: You must configure three primary credentials:

Google Drive OAuth2 API: Used by the File Created n8n trigger and subsequent file operations (Download, Convert, Delete).
OpenAI API: Used by the Embeddings OpenAI1 n8n node for vector generation.
* Supabase API: Used by the Insert into Supabase Vectorstore1 n8n node to connect to your vector database.

  1. Google Drive Configuration: Ensure the File Created n8n trigger node is set to watch the correct folder ID where documents will be uploaded. The current n8n workflow is configured to watch a folder named 'DOCUMENTS'.

  2. Supabase Table Setup: Ensure your Supabase database has the necessary vector store table (named documents in this configuration) with appropriate schema and indexing for vector storage.

  3. Activation: Save the n8n workflow and set it to 'Active' to start monitoring the Google Drive folder.

Node Details

File Created (Google Drive Trigger n8n trigger node): Starts the entire n8n workflow upon detecting a new file in a specific Google Drive folder. Crucial for real-time RAG ingestion.
Switch2 (n8n node): Acts as a router, checking the file's MIME type. It branches the flow based on whether the file is a PDF, a native Google Doc, an Excel sheet, or a convertible Word document.
Convert to Google Doc1 (HTTP Request n8n node): Specifically handles MS Word document types. It uses the Google Drive API to create a copy of the file, forcing conversion into a Google Document format, which simplifies subsequent text extraction.
Extract PDF Text / Extract from Text File / Extract from Excel (n8n nodes): These nodes perform the actual heavy lifting of parsing different file formats into usable text data.
Recursive Character Text Splitter (n8n node): A critical step in the RAG pipeline. It splits the extracted document content into uniform, overlapping chunks (2000 characters size, 200 overlap), maximizing context preservation for the vector database.
Embeddings OpenAI1 (n8n node): Generates numerical vector representations (embeddings) of the text chunks using the OpenAI model, making the text searchable by semantic similarity.


  • Insert into Supabase Vectorstore1 (n8n node): The final destination for the data. This n8n node securely pushes the text chunk, its metadata, and its corresponding embedding vector into the designated Supabase table.

Related n8n Workflows

Free

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by
edisantosa
edisantosa

Featured*