Skip to main content

Load and aggregate files from a Google Drive folder into a key-value dictionary

Workflow preview

Workflow preview
100%
Load and aggregate files from a Google Drive folder into a key-value dictionary preview
Open on n8n.io

Important notice

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

1. Workflow Overview

What does this template do? This workflow automates the process of retrieving all Google Docs from a specified Google Drive folder, extracting their content, and structuring the data into a unified...

Best for

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

Tools used

n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.code, n8n-nodes-base.stickynote, n8n-nodes-base.googledrive, n8n-nodes-base.googledocs, n8n-nodes-base.set

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Load and aggregate files from a Google Drive folder into a key-value dictionary
Workflow name
Load and aggregate files from a Google Drive folder into a key-value dictionary

What does this template do?

This workflow automates the process of retrieving all Google Docs from a specified Google Drive folder, extracting their content, and structuring the data into a unified key-value dictionary, where:

  • Key = The file name
  • Value = The content of the document (with normalized newlines)

This is ideal for use cases such as knowledge ingestion, prompt context preparation, or populating a RAG (Retrieval-Augmented Generation) system with reference documents.

Use Case

Perfect for teams or individuals who maintain prompts, content, or reference material in Google Docs and want to integrate that data dynamically into automation or AI workflows.

What the Workflow Does

  • ⚑ Triggered via Execute Workflow Trigger from another workflow
  • πŸ“ Retrieves all files from a specified Google Drive folder
  • πŸ“„ Downloads the full content of each Google Docs file
  • 🧩 Maps each file name to its content using a Set node
  • 🧠 Aggregates all entries into a single dictionary with Code node
  • 🧾 Outputs a JSON object like:
{
  "Doc1": "content of doc 1",
  "Doc2": "content of doc 2"
}

Apps & Services Used

  • Google Drive
  • Google Docs
  • n8n Code node

Pre-requisites

  • A connected Google account with access to the target Drive folder
  • OAuth2 credentials for both:
  • Google Drive
  • Google Docs

Customization Tips

  • Change Folder: Update the Google Drive node to select a specific folder rather than root
  • Support Other File Types: Replace or complement the Google Docs node to handle other formats (e.g., PDFs or text files)
  • Data Cleaning: Modify the Code node to adjust text normalization to your needs

Additional Use Cases

🧠 Prompt Management for AI Workflows
  • Centralize your GPT prompt templates in Google Docs instead of hardcoding them in n8n
  • Easily manage prompt versions and edits directly from Google Drive
  • Dynamically load prompts into downstream nodes (like OpenAI or Hugging Face) without redeploying workflows
πŸ“š Knowledge Base Loader for RAG Systems
  • Aggregate internal knowledge, FAQs, SOPs, or policy docs from Google Docs into a structured dictionary
  • Use the resulting object as the context source for Retrieval-Augmented Generation models
πŸŽ›οΈ Dynamic Form Inputs or Question Sets
  • Maintain forms, surveys, or interview questions in Google Docs
  • Load the content into n8n for form generation, chatbot interaction, or customer intake flows
πŸ“„ Client-Specific Config or Script Templates
  • For client onboarding workflows, load client-specific scripts or prompts from individual docs named after each client
  • Helps automate client-facing document generation or AI interactions
πŸ“‹ Content Ingestion for Translation, Summarization, or Sentiment Analysis
  • Batch process internal documentation or user-submitted Google Docs
  • Trigger summarization, translation, or classification pipelines using the document contents
πŸ”„ Document-to-Database Import
  • Automatically fetch and normalize Google Docs contents, ready to push into a database (e.g., Notion, Airtable, PostgreSQL)

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 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 2 - Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Sticky Note

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

Block 4 - Get files from folder

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

Block 5 - Download Google Docs

Type / Role
n8n-nodes-base.googleDocs - googleDocs
Config choices
Version 2

Block 6 - Sticky Note1

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

Block 7 - Mapping

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - Sticky Note2

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

3. Summary Table

Workflow Load and aggregate files from a Google Drive folder into a key-value dictionary
Complexity intermediate
Nodes 8
Categories Document Extraction, AI RAG
Author Hugues Stock
Published 03 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3421/3421.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 Load and aggregate files from a Google Drive folder into a key-value dictionary do?

What does this template do? This workflow automates the process of retrieving all Google Docs from a specified Google Drive folder, extracting their content, and structuring the data into a unified...

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.