Auto-Generate Exam Questions From Google Docs Using n8n & AI

This n8n workflow automates creating open and multiple-choice exam questions from Google Docs educational content using AI and vector databases. It saves educators hours by generating curriculum-aligned assessments with precise answers and distractors.
manualTrigger
httpRequest
googleDocs
+15
Workflow Identifier: 1248
NODES in Use: manualTrigger, httpRequest, googleDocs, code, convertToFile, documentDefaultDataLoader, textSplitterTokenSplitter, embeddingsOpenAi, vectorStoreQdrant, retrieverVectorStore, lmChatGoogleGemini, outputParserItemList, splitInBatches, chainLlm, chainRetrievalQa, agent, outputParserStructured, googleSheets
Auto generate exam questions with n8n and AI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow reads a Google Docs article with educational content.

It makes two kinds of exam questions: open-ended and multiple-choice.

It uses AI to understand the text and a vector database to keep track of important parts.

The questions are saved to Google Sheets for easy use.


Who should use this workflow

Teachers or educators who want to save time making exam questions.

People who store study material in Google Docs and want questions made fast without mistakes.


Tools and services used

  • n8n: Automation platform where the workflow runs.
  • Google Docs API: Fetches the article content.
  • Google Sheets API: Stores the generated questions and answers.
  • OpenAI API: Creates text embeddings for document chunks.
  • Google PaLM API (Google Gemini): AI models generate questions and answers.
  • Qdrant Vector Database: Stores vectors for semantic search and retrieval.

How the workflow works (Input → Process → Output)

Input

The workflow starts when manually triggered.

The user gives the Google Docs URL with the educational article.

Processing steps

The workflow fetches the Google Docs content as JSON.

It converts this JSON into Markdown format, keeping headings and text styles.

The markdown is turned into a plain text file for AI processing.

This text is split into smaller parts (chunks) using tokens.

OpenAI creates embeddings (vectors) for each chunk.

Vectors are stored in the Qdrant database for fast semantic searching.

Google Gemini AI models generate 10 open-ended questions that ask for thoughtful answers.

Each open-ended question is checked against the vector store to produce accurate answers.

Results are saved to Google Sheets in one tab.

The Gemini model also generates 10 multiple-choice questions with one correct and three wrong but close answers.

These multiple-choice questions are validated and saved to another Google Sheets tab.

Output

The user gets two sets of exam questions: open-ended and multiple-choice.

Questions and answers are organized in Google Sheets, ready for use.


Beginner step-by-step: How to build this in n8n

1. Download and import the workflow

  1. Download the provided workflow file using the Download button on this page.
  2. In the n8n editor, click “Import from File” and select the downloaded workflow.

2. Configure credentials and settings

  1. Add your Google Docs and Google Sheets OAuth2 credentials in n8n’s credential manager.
  2. Add OpenAI API Key for embeddings generation.
  3. Add Google PaLM API Key or OAuth2 credentials for Gemini chat models.
  4. Set Qdrant database URL and API Key in the HTTP Request nodes for collection management and vector insertion.
  5. Update the Google Docs document URL in the Get Doc node to match your article.
  6. Update Google Sheets IDs and worksheet names if you want to save questions to your own sheet.

3. Test and activate

  1. Run the workflow once using the Test button to verify all nodes work and generate questions.
  2. Check your Google Sheets for the new exam questions data.
  3. If all works, activate the workflow in n8n to use it for production.

Consider self-host n8n for more control and security if running on your own server.


Customization ideas

  • Change the document URL in Get Doc to use different articles.
  • Adjust chunk size and overlap in the Token Splitter for finer or broader text sections.
  • Switch AI models in the question generation nodes to adjust question style or difficulty.
  • Edit Qdrant collection parameters like vector size or distance metric for different data types.
  • Modify Google Sheets columns or add email integration for automatic question sharing.

Edge cases and common errors

  • Qdrant 401 Unauthorized error: Check API key is correct in HTTP Request headers.
  • Google Docs fetch failure: Verify OAuth2 access and the document URL is valid and shared correctly.
  • OpenAI embedding timeout: Reduce chunk size or add retries to handle API limits.
  • AI generated questions seem wrong or repeat: Adjust chunk sizes or add more article content for better training context.

Summary of benefits and results

✓ Saves many hours by automating question creation.

✓ Produces both open-ended and multiple-choice questions from Google Docs.

✓ Uses AI combined with vector search to make accurate and relevant questions.

→ Gives clear, organized output in Google Sheets ready for educators to use.


Auto generate exam questions with n8n and AI

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Frequently Asked Questions

Yes, but the document fetching and conversion nodes need changes to handle different formats.
Yes, OpenAI embeddings and Google Gemini chat models consume API quota based on request size and frequency.
Data security depends on correct API credential handling in n8n and security settings of Google Sheets and Qdrant.
Yes, with token splitting and vector search; large documents may need chunk size adjustments for best results.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.