Skip to main content

📥 Transform Google Drive documents into vector embeddings

Workflow preview

Workflow preview
100%
📥 Transform Google Drive documents into vector embeddings preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Automatically convert documents from Google Drive into vector embeddings using OpenAI, LangChain, and PGVector — fully automated through n8n. ️ What It Does This workflow monitors a Google Drive f...

Best for

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

Tools used

@n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, @n8n/n8n-nodes-langchain.vectorstorepgvector, n8n-nodes-base.manualtrigger, n8n-nodes-base.splitinbatches, n8n-nodes-base.googledrive, n8n-nodes-base.scheduletrigger, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
📥 Transform Google Drive documents into vector embeddings
Workflow name
📥 Transform Google Drive documents into vector embeddings

Automatically convert documents from Google Drive into vector embeddings using OpenAI, LangChain, and PGVector — fully automated through n8n.


⚙️ What It Does

This workflow monitors a Google Drive folder for new files, supports multiple file types (PDF, TXT, JSON), and processes them into vector embeddings using OpenAI’s text-embedding-3-small model. These embeddings are stored in a Postgres database using the PGVector extension, making them query-ready for semantic search or RAG-based AI agents.

After successful processing, files are moved to a separate “vectorized” folder to avoid duplication.


💡 Use Cases

  • Powering Retrieval-Augmented Generation (RAG) AI agents
  • Semantic search across private documents
  • AI assistant knowledge ingestion
  • Automated document pipelines for indexing or classification

🧠 Workflow Highlights

  • Trigger Options: Manual or Scheduled (3 AM daily by default)
  • Supported File Types: PDF, TXT, JSON
  • Embedding Stack: LangChain Text Splitter, OpenAI Embeddings, PGVector
  • Deduplication: Files are moved after processing
  • License: CC BY-SA 4.0
  • Author: AlexK1919

🛠 What You’ll Need

  • Google Drive OAuth2 credentials (connected to Search Folder, Download File, and Move File nodes)
  • OpenAI API Key (used in the Embeddings OpenAI node)
  • Postgres + PGVector database (connected in the Postgres PGVector Store node)

🔧 Step-by-Step Setup Instructions

  1. Create Google OAuth2 credentials in n8n and connect them to all Google Drive nodes.
  2. Set your source folder ID in the Search Folder node — this is where incoming files are placed.
  3. Set your processed folder ID in the Move File node — files will be moved here after vectorization.
  4. Ensure you have a PGVector-enabled Postgres instance and input the table name and collection in the Postgres PGVector Store node.
  5. Add your OpenAI credentials to the Embeddings OpenAI node and select text-embedding-3-small.
  6. Optional: Activate the Schedule Trigger node to run daily or configure your own schedule.
  7. Run manually by triggering When clicking ‘Test workflow’ for on-demand ingestion.

🧩 Customization Tips

Want to support more file types or enhance the pipeline?

  • Add new extractors: Use Extract from File with other formats like DOCX, Markdown, or HTML.
  • Refine logic by file type: The Switch node routes files to the correct extraction method based on MIME type (application/pdf, text/plain, application/json).
  • Pre-process with OCR: Add an OCR step before extraction to handle scanned PDFs or images.
  • Add filters: Enhance the Search Folder or Switch node logic to skip specific files or folders.

📄 License

This workflow is available under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license. You are free to use, adapt, and share this workflow for non-commercial purposes under the terms of this license.

Full license details: https://creativecommons.org/licenses/by-nc-sa/4.0/

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 - Default Data Loader

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

Block 2 - Recursive Character Text Splitter

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

Block 3 - Postgres PGVector Store

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

Block 4 - When clicking ‘Test workflow’

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

Block 5 - Loop Over Items

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

Block 6 - Move File

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

Block 7 - Download File

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

Block 8 - Search Folder

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

Block 9 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 10 - Sticky Note

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

Block 11 - Switch

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

Block 12 - Extract from PDF

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

Block 13 - Extract from Text

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

Block 14 - Extract from JSON

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

Block 15 - Embeddings OpenAI

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

3. Summary Table

Workflow 📥 Transform Google Drive documents into vector embeddings
Complexity advanced
Nodes 15
Categories Document Extraction, AI RAG
Author Alex Kim
Published 21 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3647/3647.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 📥 Transform Google Drive documents into vector embeddings do?

Automatically convert documents from Google Drive into vector embeddings using OpenAI, LangChain, and PGVector — fully automated through n8n. ️ What It Does This workflow monitors a Google Drive f...

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.