Automate OCR document ingestion from Google Drive into a Pinecone vector database using an advanced n8n workflow. This n8n template handles complex Arabic text cleaning, metadata extraction, and OpenAI embeddings for building scalable RAG knowledge bases.
Download this n8n workflow template and start using it instantly.
Manually processing large batches of OCR output files (like those generated by Google Vision or Document AI) and preparing them for a vector database is tedious and prone to error. This sophisticated n8n workflow solves this by providing a zero-touch pipeline. It automatically detects new OCR JSON files in a designated Google Drive folder. Crucially, the n8n template uses custom JavaScript logic to extract essential lesson metadata directly from the filename, clean and normalize the complex Arabic text, and chunk the content efficiently. By integrating the OpenAI n8n node for high-quality embeddings and the Pinecone n8n node for storage, this n8n workflow creates a reliable and scalable foundation for semantic search and AI knowledge retrieval, concluding by archiving the source file.
This automation begins with the Watch Drive Folder (new files) n8n trigger. When a new file appears in the input Google Drive folder, the n8n workflow immediately starts executing.
To deploy this powerful n8n workflow, follow these steps:
Folder To Watch parameter with the ID of your input folder.Folder ID parameter with the ID of your archive folder. Watch Drive Folder (new files) (n8n trigger):
Function: Polls a specific Google Drive folder for newly created files.
Key Configuration: Event: fileCreated, Trigger On: specificFolder, set to poll every minute.
Filename → Lesson Metadata (Code n8n node):
Function: Custom JavaScript logic to parse complex, structured filenames (e.g., arabicg12arlesson01...) into clean, usable metadata fields (e.g., titlear, bookid, namespace).
Key Configuration: Contains extensive regex and string manipulation for robust data extraction.
Vision JSON → Clean Text Chunks (Code n8n node):
Function: The central processing n8n node. Reads the base64-encoded OCR JSON file, extracts the full text annotation, normalizes Arabic characters, cleans up document noise, and implements a semantic chunking algorithm.
Key Configuration: Custom functions for normalizeAr and makeChunks (max size 900, overlap 150).
Generate Embeddings (OpenAI) (LangChain n8n node):
Function: Generates high-dimensional vector embeddings for each text chunk using the OpenAI API.
Key Configuration: Uses the credentials defined for OpenAI.
Insert into Pinecone Vector Store (LangChain n8n node):
Function: Uploads the text, embeddings, and detailed metadata to the specified Pinecone index and dynamically determined namespace.
Key Configuration: Mode: insert, dynamically sets pineconeNamespace based on metadata, Embedding Batch Size: 64 for efficient ingestion.
Move File to Archive (Google Drive n8n node):
Function: Moves the successfully processed file to a designated archive location.
Key Configuration: Operation: move, uses the ID from the initial n8n trigger output.
Automate massive parallel processing of prompts using the Azure OpenAI Batch API. This n8n workflow template handles file upload, polling, and result parsing for high-throughput AI tasks.

Build an advanced multimodal Telegram chatbot using n8n that processes text, audio, images, videos, and various document types (PDF, CSV, HTML, XLSX). This n8n workflow uses PostgreSQL for state management and Gemini AI for intelligent analysis and chat memory.

Learn how to build an efficient n8n workflow to handle bulk file uploads from a form, process binary data sequentially using an n8n loop, and save each file. Use this n8n template for advanced file management.

Use this powerful n8n workflow to automate receipt processing. Receive images via WhatsApp, extract store, total, and payment data using GPT-4o-mini, log data to Google Sheets, and send instant confirmation messages.

Use this advanced n8n workflow to automatically process receipt photos sent via Telegram using Google Vision OCR and OpenRouter LLMs, structuring and saving financial data to Google Sheets.

Use this robust n8n workflow to automate HR tasks. It watches Google Drive for new resumes, uses GPT-4o for data extraction, saves structured data to Google Sheets, and automatically creates hiring tasks in ClickUp. A prime example of effective n8n templates.

Automation Engineer & Laravel Developer specialized in building AI-powered workflows and backend integrations. I design end-to-end automation systems combining n8n, custom APIs, and scalable Laravel backends. My focus is creating clean, modular, production-ready workflows for SaaS platforms, customer support systems, payment processing, and Telegram/WhatsApp bots. I bridge the gap between automation tools and custom backend development to deliver real business value.







































