# Automated document ingestion & vectorization with RAG: n8n workflow

> Started by someone opening a chat with it, and works across Google Docs, Google Drive, Supabase and Supabase vectors.

Source: https://millionrounds.com/workflow/automated-document-ingestion-and-vectorization-with-rag (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Automated document ingestion & vectorization with RAG

Started by someone opening a chat with it, and works across Google Docs, Google Drive, Supabase and Supabase vectors. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 47 steps, 4 branches, 2 loops or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomated-document-ingestion-and-vectorization-with-rag)

**47 steps** Large: read it before trusting it with anything live

**4** Branches: places the flow splits

**2** Loops or waits

**4** Services it connects to

## The flow

Starts it 4 Model 15 Logic 14 Service 14

The steps in the order they run, from what starts it.

- 1 **Embeddings OpenAI1** Embeddings Open Ai *Model*
- 2 **Recursive Character Text Splitter** Text Splitter Recursive Character Text Splitter *Model*
- 3 **When chat message received** Chat trigger *Starts it*
- 4 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 5 **Postgres Chat Memory** Memory Postgres Chat *Model*
- 6 **Embeddings OpenAI** Embeddings Open Ai *Model*
- 7 **Structured Output Parser** Output Parser Structured *Model*
- 8 **OpenAI Chat Model1** Lm Chat Open Ai *Model*
- 9 **New files** Google Drive trigger *Starts it*
- 10 **Update Files** Google Drive trigger *Starts it*
- 11 **New files1** Google Drive trigger *Starts it*
- 12 **Query Vector Store** Tool Workflow *Model*
- 13 **Supabase Vector Store1** Vector Store Supabase *Model*
- 14 **Default Data Loader1** Document Default Data Loader *Model*
- 15 **AI Agent** Agent *Model*
- 16 **Documents knowledge** Vector Store Supabase *Model*
- 17 **Auto-fixing Output Parser** Output Parser Autofixing *Model*
- 18 **Basic LLM Chain** Chain Llm *Model*
- 19 **Loop Over Items1** Split In Batches *Logic*
- 20 **Loop Over Items** Split In Batches *Logic*
- 21 **Set metadata** Set *Logic*
- 22 **Download file** Google Drive *Service*
- 23 **Search Record Manager1** Supabase *Service*
- 24 **Set Text for Embedding** Set *Logic*
- 25 **Switch1** Switch *Logic*
- 26 **If1** If *Logic*
- 27 **Get a document** Google Docs *Service*
- 28 **Extract from File** Extract From File *Service*
- 29 **Extract from File1** Extract From File *Service*
- 30 **Delete Previous Vector1** Supabase *Service*
- 31 **Delete a file** Google Drive *Service*
- 32 **Set Text** Set *Logic*
- 33 **Strip out New lines & Whitespace** Set *Logic*
- 34 **Markdown** Markdown *Logic*
- 35 **Update record manager1** Supabase *Service*
- 36 **Generate Hash** Crypto *Service*
- 37 **If** If *Logic*
- 38 **Search Record Manager** Supabase *Service*
- 39 **Set content pdf** Set *Logic*
- 40 **Download file1** Google Drive *Service*
- 41 **Switch** Switch *Logic*
- 42 **Extract text** Mistral Ai *Model*
- 43 **Created a row in record manager** Supabase *Service*
- 44 **Delete Previous Vector** Supabase *Service*
- 45 **Réunir toutes pages** Code *Logic*
- 46 **Update record manager** Supabase *Service*
- 47 **Set content ocr** Set *Logic*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 47, with 4 branches, 2 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Docs, Google Drive, Supabase, Supabase vectors
- **Model:** OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Google Docs, Google Drive, Supabase and Supabase vectors accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 47 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 47 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomated-document-ingestion-and-vectorization-with-rag)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Docs](https://millionrounds.com/workflows?service=Google+Docs#library)[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)[Supabase](https://millionrounds.com/workflows?service=Supabase#library)[Supabase vectors](https://millionrounds.com/workflows?service=Supabase+vectors#library)

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**AI agent to chat with Google Drive** 49 steps · calls a model · Google Drive, Supabase](https://millionrounds.com/workflow/ai-agent-to-chat-with-google-drive)
- [**Create restorable n8n Docker backups in Google Drive with SSH** 44 steps · Google Drive](https://millionrounds.com/workflow/create-restorable-n8n-docker-backups-in-google-drive-with-ss)
- [**Multimodal Political AI Chatbot for WhatsApp: Text, Voice** 37 steps · calls a model · Google Drive, Pinecone](https://millionrounds.com/workflow/multimodal-political-ai-chatbot-for-whatsapp-text-voice)
- [**Verify onboarding compliance documents with OpenAI** 37 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/verify-onboarding-compliance-documents-with-openai)
- [**My solution for the "Agentic Arena Community Contest" with RAG** 34 steps · calls a model · Google Drive, Qdrant](https://millionrounds.com/workflow/my-solution-for-the-agentic-arena-community-contest-with-rag)
- [**Automate document approvals with Supabase and Gmail** 33 steps · Gmail, Supabase](https://millionrounds.com/workflow/automate-document-approvals-with-supabase-and-gmail)
