AutomationFlowsAI & RAG › Multi-format Document Processing for RAG Chatbot with Google Drive & Supabase

Multi-format Document Processing for RAG Chatbot with Google Drive & Supabase

Byedisantosa @edsan on n8n.io

This n8n workflow is the data ingestion pipeline for the "RAG System V2" chatbot. It automatically monitors a specific Google Drive folder for new files, processes them based on their type, and inserts their content into a Supabase vector database to make it searchable for the…

Event trigger★★★★☆ complexityAI-powered18 nodesHTTP RequestGoogle DriveText Splitter Recursive Character Text SplitterOpenAI EmbeddingsDocument Default Data LoaderGoogle Drive TriggerSupabase Vector Store
AI & RAG Trigger: Event Nodes: 18 Complexity: ★★★★☆ AI nodes: yes Added:
Multi-format Document Processing for RAG Chatbot with Google Drive & Supabase — n8n workflow card showing HTTP Request, Google Drive, Text Splitter Recursive Character Text Splitter integration

This workflow corresponds to n8n.io template #9933 — we link there as the canonical source.

This workflow follows the Documentdefaultdataloader → OpenAI Embeddings recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "vAtv4ejDkrQLAj9t",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "RAG System V2 - Upload Doc",
  "tags": [
    {
      "id": "X3XA7mO6MQZQ8uNT",
      "name": "RAG",
      "createdAt": "2024-12-23T14:38:50.002Z",
      "updatedAt": "2024-12-23T14:38:50.002Z"
    },
    {
      "id": "bQac7pgkCzmq5Nt5",
      "name": "template",
      "createdAt": "2025-01-14T11:43:47.391Z",
      "updatedAt": "2025-01-14T11:43:47.391Z"
    },
    {
      "id": "pms2jtgY49JCgVDW",
      "name": "chatbot",
      "createdAt": "2024-12-19T04:39:23.549Z",
      "updatedAt": "2024-12-19T04:39:23.549Z"
    }
  ],
  "nodes": [
    {
      "id": "f7e70a86-f762-46ff-a38c-dd03f8cc44be",
      "name": "Aggregate1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1780,
        1380
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "21c23538-5a7f-419d-a217-e163411f4ea6",
      "name": "Summarize1",
      "type": "n8n-nodes-base.summarize",
      "position": [
        1980,
        1380
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "data",
              "aggregation": "concatenate"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "73577db5-3e5f-4764-9ac0-ef5a300ae616",
      "name": "Extract PDF Text",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1580,
        1040
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "9ab1b75d-e2c6-4adf-851f-0e12ef181d59",
      "name": "Extract from Excel",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1580,
        1380
      ],
      "parameters": {
        "options": {},
        "operation": "xlsx"
      },
      "typeVersion": 1
    },
    {
      "id": "f6736e78-4665-4834-8057-fb226a5a623b",
      "name": "Convert to Google Doc1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1580,
        1560
      ],
      "parameters": {
        "url": "=https://www.googleapis.com/drive/v3/files/{{ $('Set File ID1').item.json.file_id }}/copy",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $('Set File ID1').item.json.name }}"
            },
            {
              "name": "mimeType",
              "value": "application/vnd.google-apps.document"
            }
          ]
        },
        "nodeCredentialType": "googleDriveOAuth2Api"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "740cdb21-cb2a-4797-925d-6a52058abfc9",
      "name": "Delete File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1780,
        1560
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set File ID1').item.json.file_id }}"
        },
        "options": {},
        "operation": "deleteFile"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "d14991af-cca4-4677-a0bd-2c2e54c2663c",
      "name": "Set File ID1",
      "type": "n8n-nodes-base.set",
      "position": [
        280,
        1340
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "10646eae-ae46-4327-a4dc-9987c2d76173",
              "name": "file_id",
              "type": "string",
              "value": "={{ $('File Created').item.json.id }}"
            },
            {
              "id": "f4536df5-d0b1-4392-bf17-b8137fb31a44",
              "name": "file_type",
              "type": "string",
              "value": "={{ $('File Created').item.json.mimeType }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6908359b-74bb-4a9c-9f55-cc8b3c702762",
      "name": "Download File1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        600,
        1500
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set File ID1').item.json.file_id }}"
        },
        "options": {
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "text/plain"
            }
          }
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "40c88ce1-ac7f-4e4c-8a63-c2569ceb92f5",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        2440,
        1420
      ],
      "parameters": {
        "options": {
          "splitCode": "markdown"
        },
        "chunkSize": 2000,
        "chunkOverlap": 200
      },
      "typeVersion": 1
    },
    {
      "id": "4d8b2f11-0eaf-4fa5-a9a8-5d02114b3cf7",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        2200,
        1360
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "70466e58-b38e-47ac-b2d1-9efe394fe216",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        920
      ],
      "parameters": {
        "color": 4,
        "width": 3060,
        "height": 920,
        "content": "# Watch Trigger (Drive) - Files Created\n## Beberapa file baru diupload di folder yang sudah ditentukan -> cek tipe/format file lalu konvert jika perlu -> tambahkan ke vector database\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2e91ada5-a052-4c5a-9dda-36340de054cc",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        440,
        1340
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "430a6cd1-1ffe-477d-88f3-58539898b38e",
      "name": "Enhanced Default Data Loader1",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        2360,
        1260
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "=file_id",
                "value": "={{ $('Set File ID1').item.json.file_id }}"
              },
              {
                "name": "=version",
                "value": "v1"
              },
              {
                "name": "=creator",
                "value": "={{ $('File Created').item.json.owners[0].displayName }}"
              },
              {
                "name": "=created_at",
                "value": "={{ $('File Created').item.json.createdTime }}"
              },
              {
                "name": "last_modified",
                "value": "={{ $('File Created').item.json.modifiedTime }}"
              },
              {
                "name": "folder_path",
                "value": "DOCUMENTS"
              },
              {
                "name": "file_name",
                "value": "={{ $('File Created').item.json.name }}"
              },
              {
                "name": "file_extension",
                "value": "={{ $('File Created').item.json.mimeType }}"
              }
            ]
          }
        },
        "jsonData": "={{ $json.data || $json.text || $json.concatenated_data }}",
        "jsonMode": "expressionData"
      },
      "typeVersion": 1
    },
    {
      "id": "37835911-6114-437c-b10f-d321086e51cf",
      "name": "File Created",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        80,
        1340
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1M9h9OnDSWa0kV7_Yj7fdSFHhM57pMPX8",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1M9h9OnDSWa0kV7_Yj7fdSFHhM57pMPX8",
          "cachedResultName": "DOCUMENTS"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a29c58f1-4a87-40c7-8326-13c976e43a45",
      "name": "Extract from Text File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1580,
        1200
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "20cbced4-0d98-4f80-99a4-94c0ae7d05d4",
      "name": "Switch2",
      "type": "n8n-nodes-base.switch",
      "position": [
        1000,
        1260
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "PDF",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Set File ID1').item.json.file_type }}",
                    "rightValue": "application/pdf"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Text File",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "fc193b06-363b-4699-a97d-e5a850138b0e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Set File ID1').item.json.file_type }}",
                    "rightValue": "application/vnd.google-apps.document"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Excel",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2ae7faa7-a936-4621-a680-60c512163034",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Set File ID1').item.json.file_type }}",
                    "rightValue": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Windows Doc(1)",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7ddfa924-1c26-4ee3-9890-5c9d2b96717a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Set File ID1').item.json.file_type }}",
                    "rightValue": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Windows Doc(2)",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f53caf8b-7a8f-4d1e-98f4-deaf0e0171f0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Set File ID1').item.json.file_type }}",
                    "rightValue": "application/msword"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Windows Doc(3)",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "cd9ca627-d00d-4c30-903a-41f603c8e36f",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Set File ID1').item.json.file_type }}",
                    "rightValue": "application/vnd.ms-word"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": 2
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c7ba8d80-5aa5-4012-8af4-37d7a13e19de",
      "name": "Insert into Supabase Vectorstore1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        2180,
        1060
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "queryName": "match_documents"
        },
        "tableName": {
          "__rl": true,
          "mode": "id",
          "value": "=documents"
        }
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a0632671-bc58-4129-bc96-7f7aa04c4baf",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        1880
      ],
      "parameters": {
        "width": 440,
        "height": 120,
        "content": "## CREDITS\n### This Workflow Is Originally by Nate Herk.\n[Check his community here](https://www.skool.com/ai-automation-society-plus/about)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "20dea69a-1a23-4a35-8694-f1658686fb3f",
  "connections": {
    "Switch2": {
      "main": [
        [
          {
            "node": "Extract PDF Text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from Text File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from Excel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to Google Doc1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to Google Doc1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to Google Doc1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate1": {
      "main": [
        [
          {
            "node": "Summarize1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize1": {
      "main": [
        [
          {
            "node": "Insert into Supabase Vectorstore1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Created": {
      "main": [
        [
          {
            "node": "Set File ID1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set File ID1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Switch2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract PDF Text": {
      "main": [
        [
          {
            "node": "Insert into Supabase Vectorstore1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Insert into Supabase Vectorstore1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Extract from Excel": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Google Doc1": {
      "main": [
        [
          {
            "node": "Delete File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from Text File": {
      "main": [
        [
          {
            "node": "Insert into Supabase Vectorstore1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enhanced Default Data Loader1": {
      "ai_document": [
        [
          {
            "node": "Insert into Supabase Vectorstore1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Enhanced Default Data Loader1",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow is the data ingestion pipeline for the "RAG System V2" chatbot. It automatically monitors a specific Google Drive folder for new files, processes them based on their type, and inserts their content into a Supabase vector database to make it searchable for the…

Source: https://n8n.io/workflows/9933/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

RAG_Ingest. Uses httpRequest, vectorStoreSupabase, documentDefaultDataLoader, textSplitterRecursiveCharacterTextSplitter. Event-driven trigger; 73 nodes.

HTTP Request, Supabase Vector Store, Document Default Data Loader +4
AI & RAG

This n8n template automatically classifies incoming emails (Sales, Support, Internal, Finance, Promotions) and routes them to a dedicated OpenAI LLM Agent for processing. Depending on the category, th

OpenAI, Gmail, Text Classifier +16
AI & RAG

Automate Outreach Prospect automates finding, enriching, and messaging potential partners (like restaurants, malls, and bars) using Apify Google Maps scraping, Perplexity enrichment, OpenAI LLMs, Goog

@Devlikeapro/N8N Nodes Waha, Google Drive Trigger, @Apify/N8N Nodes Apify +14
AI & RAG

Chat with docs - 5minAI New version. Uses httpRequest, documentDefaultDataLoader, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi. Event-driven trigger; 62 nodes.

HTTP Request, Document Default Data Loader, Text Splitter Recursive Character Text Splitter +10
AI & RAG

I prepared a detailed guide that illustrates the entire process of building an AI agent using Supabase and Google Drive within N8N workflows.

HTTP Request, Document Default Data Loader, Text Splitter Recursive Character Text Splitter +10