AutomationFlowsAI & RAG › RAG Google Drive Supabase

RAG Google Drive Supabase

RAG Google Drive Supabase. Uses googleDriveTrigger, googleDrive, openAI, supabase. Event-driven trigger; 8 nodes.

Event trigger★★★★☆ complexityAI-powered8 nodesGoogle Drive TriggerGoogle DriveOpenAISupabase
AI & RAG Trigger: Event Nodes: 8 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Google Drive → Google Drive Trigger 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
{
  "name": "RAG Google Drive Supabase",
  "nodes": [
    {
      "parameters": {
        "folderId": "root",
        "event": "fileUpdated"
      },
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "credentials": {
        "googleDriveOAuth2Api": "<your credential>"
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": "={{$json[\"id\"]}}",
        "binaryPropertyName": "data"
      },
      "name": "Download File",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        500,
        300
      ],
      "credentials": {
        "googleDriveOAuth2Api": "<your credential>"
      }
    },
    {
      "parameters": {
        "functionCode": "const fileData = $binary.data.data;\nconst text = Buffer.from(fileData,'base64').toString('utf-8');\nreturn [{json:{fileName:$json[\"name\"],content:text}}];"
      },
      "name": "Extract Content",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {
        "fieldToSplit": "content",
        "chunkSize": 500,
        "overlap": 50
      },
      "name": "Split In Chunks",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        1000,
        300
      ]
    },
    {
      "parameters": {
        "resource": "embeddings",
        "operation": "create",
        "model": "text-embedding-3-small",
        "input": "={{$json[\"chunk\"]}}"
      },
      "name": "Create Embeddings",
      "type": "n8n-nodes-base.openAI",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ],
      "credentials": {
        "openAIApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "functionCode": "return $input.all().map(item=>({json:{id:`${item.json.fileName}-${Math.random().toString(36).substr(2,7)}`,fileName:item.json.fileName,embedding:item.json.embedding,metadata:{fileName:item.json.fileName}}}));"
      },
      "name": "Prepare Vectors",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1500,
        300
      ]
    },
    {
      "parameters": {
        "operation": "delete",
        "table": "vectors",
        "rowFilter": "={{`fileName=\\'${$json[\"fileName\"]}\\'`}}"
      },
      "name": "Delete Old Vectors",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        1750,
        300
      ],
      "credentials": {
        "supabaseApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "operation": "insert",
        "table": "vectors",
        "columns": "id,fileName,embedding,metadata",
        "values": "={{[{ json: $json }][0]}}"
      },
      "name": "Insert Updated Vectors",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        2000,
        300
      ],
      "credentials": {
        "supabaseApi": "<your credential>"
      }
    }
  ],
  "connections": {
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Extract Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Content": {
      "main": [
        [
          {
            "node": "Split In Chunks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split In Chunks": {
      "main": [
        [
          {
            "node": "Create Embeddings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Embeddings": {
      "main": [
        [
          {
            "node": "Prepare Vectors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Vectors": {
      "main": [
        [
          {
            "node": "Delete Old Vectors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Old Vectors": {
      "main": [
        [
          {
            "node": "Insert Updated Vectors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "1"
}

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

RAG Google Drive Supabase. Uses googleDriveTrigger, googleDrive, openAI, supabase. Event-driven trigger; 8 nodes.

Source: https://gist.github.com/ruinaldoti/1d720c7e3f0b6cb0aa2f74cd08c77265 — 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

Automatically watches a Google Drive folder, submits new documents to Landing.ai for parsing, caches processed files in - Supabase to avoid reprocessing, and reliably polls results with retry and time

Google Drive Trigger, Google Drive, Supabase +1
AI & RAG

The Problem That it Solves

Google Drive Trigger, OpenAI, Google Drive +5
AI & RAG

Content creators, YouTubers, and social media managers who want to repurpose long form videos into short clips without doing it manually. Works on self hosted n8n instances.

Google Drive Trigger, Google Drive, N8N Nodes Renderio +3
AI & RAG

Monitor a Google Drive folder, process each image based on the prompt defined in and save the new image to the specified output Google Drive folder. Maintain a processing log in Google Sheets.

Google Drive Trigger, Google Drive, HTTP Request +2
AI & RAG

This workflow automatically turns any audio file uploaded to Google Drive into a complete podcast episode. It handles transcription, content generation, blog drafting, social copy creation, thumbnail

Google Drive Trigger, Google Drive, OpenAI +3