Build a RAG Chatbot over Your Google Drive Documents
· By AI Compare
Index company files from Google Drive automatically and let your team chat with them.
What you will build
A chatbot that answers questions using your company's documents in Google Drive: policies, product docs, SOPs. When someone adds or updates a file in a folder, it is automatically indexed. Employees ask questions in a chat window and get answers grounded in those files.
This follows n8n's template "RAG chatbot for company documents using Google Drive and Gemini".
How RAG works in one paragraph
Retrieval-augmented generation (RAG) splits your documents into small chunks, turns each chunk into a vector (an embedding) and stores them in a vector database. When a user asks a question, the system finds the most similar chunks and gives them to the language model, which answers using that context instead of guessing.
What you need
- Google Drive OAuth2 credentials (setup guide).
- A Google Gemini API key from Google AI Studio (for embeddings and chat). OpenAI or Ollama also work.
- A vector store: the template uses Pinecone (create an index, for example
company-files, with the dimension matching your embedding model). Qdrant, Supabase and Postgres pgvector are alternatives.
Part 1: Ingestion workflow
| Node | Settings |
|---|---|
| Google Drive Trigger (file created) | Watch the knowledge folder |
| Google Drive Trigger (file updated) | Same folder, so edits are re-indexed |
| Google Drive: Download | Convert Google Docs to text/PDF |
| Pinecone Vector Store (insert) | Connected to the sub-nodes below |
| ↳ Default Data Loader | Reads the binary file |
| ↳ Recursive Character Text Splitter | For example chunk size 1,000, overlap 200 |
| ↳ Embeddings Google Gemini | Embedding model, for example text-embedding-004 |
Tip: store the file ID and name as metadata on each chunk. When a file is updated, delete its old chunks first to avoid duplicate or outdated answers.
Part 2: Chat workflow
| Node | Settings |
|---|---|
| Chat Trigger | Public or internal chat window |
| AI Agent | System message: "Answer only from the company documents. If the answer is not there, say so." |
| ↳ Google Gemini Chat Model | Chat model |
| ↳ Window Buffer / Simple Memory | Last few messages |
| ↳ Vector Store tool (Pinecone) | Same index and embedding model as ingestion |
Quality tips
- Use the same embedding model for ingestion and queries.
- Ask the agent to cite the source file name in each answer.
- Keep folders focused; mixing drafts and final versions confuses retrieval.
- Test with real questions from your team and adjust chunk size if answers are incomplete.
Where to put the chat
- n8n's hosted chat page (Chat Trigger public mode).
- Embedded chat widget on your intranet.
- Slack or Telegram by swapping the trigger (Slack bots, Telegram assistant).
Related
- Run local LLMs with Ollama for a fully private version
- Chat with your database using AI

