πŸ”¬ πŸ“₯ Transform Google Drive documents into vector embeddings

⚑ 8,454 views Β· πŸ”¬ Document Extraction & Analysis

Description

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


🧠 Workflow Highlights


πŸ›  What You’ll Need


πŸ”§ 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?


πŸ“„ 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/

πŸ”— Nodes Used

Google Drive, Schedule Trigger, Embeddings OpenAI, Recursive Character Text Splitter, Extract from File, Default Data Loader

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup