Skip to main content

AI-powered auto-generate exam questions and answers from Google Docs with Gemini

Workflow preview

Workflow preview
100%
AI-powered auto-generate exam questions and answers from Google Docs with Gemini preview
Open on n8n.io

Important notice

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

1. Workflow Overview

This workflow automates the creation of exam questions ( both open ended and multiple choice ) from educational content stored in Google Docs , using AI powered analysis and vector database retriev...

Best for

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

Tools used

n8n-nodes-base.manualtrigger, @n8n/n8n-nodes-langchain.vectorstoreqdrant, n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplittertokensplitter, n8n-nodes-base.stickynote, n8n-nodes-base.code

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
AI-powered auto-generate exam questions and answers from Google Docs with Gemini
Workflow name
AI-powered auto-generate exam questions and answers from Google Docs with Gemini

This workflow automates the creation of exam questions (both open-ended and multiple-choice) from educational content stored in Google Docs, using AI-powered analysis and vector database retrieval

This workflow saves educators hours of manual work while ensuring high-quality, curriculum-aligned assessments. Let me know if you'd like help adapting it for specific subjects!


Use Cases

  • Educators: Rapidly generate quizzes, midterms, or flashcards.
  • E-learning platforms: Automate question banks for courses.
  • Corporate training: Create assessments for employee onboarding.

Technical Requirements:

  • APIs: Google Gemini, OpenAI, Qdrant, Google Workspace.
  • n8n Nodes: LangChain, Google Sheets/Docs, HTTP requests, code blocks.

This workflow combines AI efficiency with human-curated quality, making it a powerful tool for modern education and training.


Advantages of This Workflow

  • Fully Automated Exam Generation: From document to fully formatted quiz content with no manual intervention.
  • Supports Comprehension and Critical Thinking: Questions are designed to go beyond factual recall, including inference and application.
  • Uses AI and RAG for Accuracy: Ensures that answers are grounded in the document content, reducing hallucination.
  • Seamless Google Integration: Pulls content from Google Docs and writes outputs to Google Sheets.
  • Scalable for Any Subject: Works with any article or content domain as input.
  • Modular and Customizable: Can be easily adapted to generate different question types or to use other LLMs or storage systems.

How It Works

  1. Document Ingestion:

    • The workflow starts by fetching an educational document (e.g., textbook chapter, lecture notes) from Google Docs.
    • Converts the document to Markdown for structured processing.
  2. AI Processing:

    • Splits text into chunks and generates vector embeddings (via OpenAI) for semantic analysis.
    • Stores embeddings in Qdrant (vector database) for retrieval.
  3. Question Generation:

    • Open-ended questions: Google Gemini AI creates 10 critical-thinking questions.
    • Multiple-choice questions: Generates 10 MCQs (1 correct + 3 plausible distractors) using RAG to validate answers against the vector DB.
  4. Answer Validation:

    • For open questions: Retrieves context-aware answers from the vector store.
    • For MCQs: Ensures distractors are incorrect but believable via AI cross-checking.
  5. Output:

    • Saves questions/answers to Google Sheets in two tabs:
      • Open questions: Question + AI-generated answer.
      • Closed questions: MCQ + options + correct answer.

Set Up Steps

  1. Prerequisites:

    • APIs/Accounts:
      • Google Workspace (Docs + Sheets).
      • OpenAI (for embeddings).
      • Google Gemini (for question generation).
      • Qdrant (vector DB – self-hosted or cloud).
    • n8n Nodes: Ensure LangChain, Google Sheets/Docs, and HTTP request nodes are installed.
  2. Configure Connections:

    • Link credentials for:
      • Google Docs/Sheets (OAuth2).
      • OpenAI (API key).
      • Google Gemini (API key).
      • Qdrant (URL + API key).
  3. Customize Input:

    • Replace the default Google Doc ID in the "Get Doc" node with your source document.
    • Adjust chunk size/overlap (Token Splitter node) for optimal text processing.
  4. Tweak Question Generation:

    • Modify prompts in:
      • "Open questions" node: Adjust criteria (e.g., difficulty, question types).
      • "Closed questions" node: Edit MCQ formatting rules.
  5. Output Settings:

    • Update the Google Sheet ID in "Write open" and "Write closed" nodes.
    • Map columns in Google Sheets to match question/answer formats.
  6. Run & Automate:

    • Trigger manually ("Test workflow") or schedule periodic runs (e.g., for updated content).

Need help customizing?

Contact me for consulting and support or add me on Linkedin.

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 clicking ‘Test workflow’

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

Block 2 - Qdrant Vector Store

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

Block 3 - Create collection

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 4 - Refresh collection

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - Embeddings OpenAI

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

Block 6 - Default Data Loader

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

Block 7 - Token Splitter

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

Block 8 - Sticky Note3

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

Block 9 - Sticky Note4

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

Block 10 - Converto di MD

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

Block 11 - Get Doc

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

Block 12 - Vector Store Retriever

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

Block 13 - Qdrant Vector Store1

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

Block 14 - Convert to File

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

Block 15 - Google Gemini Chat Model

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

Block 16 - Item List Output Parser

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

Block 17 - Loop Over Items

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

Block 18 - Google Gemini Chat Model1

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

Block 19 - Google Gemini Chat Model2

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

Block 20 - Item List Output Parser1

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

Block 21 - Loop Over Items1

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

Block 22 - Google Gemini Chat Model3

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

Block 23 - Qdrant Vector Store2

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

Block 24 - Embeddings OpenAI2

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

Showing the first 24 of 37 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow AI-powered auto-generate exam questions and answers from Google Docs with Gemini
Complexity advanced
Nodes 37
Categories Document Extraction, AI RAG
Author Davide
Published 13 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4008/4008.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 AI-powered auto-generate exam questions and answers from Google Docs with Gemini do?

This workflow automates the creation of exam questions ( both open ended and multiple choice ) from educational content stored in Google Docs , using AI powered analysis and vector database retriev...

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.