Skip to content

Every 30 minutes

Turn PDFs in Drive into two versions of a multiple-choice test

Drop a PDF into your Drive folder and get two different multiple-choice tests on it as Google Docs.

Runs
Every 30 minutes
Apps
Google Docs, Google Drive
AI
Yes, uses the built-in AI allowance
Access
Drive read; Docs write

Send this to your assistant

Create a ClickRuntime automation: when I put a PDF in my Drive 'Test material' folder, create two different multiple-choice test versions from it as Google Docs.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A secondary school teacher wants a quick quiz on each chapter of the textbook, and two versions so students sitting next to each other cannot copy. Writing twenty good questions with plausible wrong answers, twice, takes most of an evening.

Getting two ready-made test versions from the material you already have frees that evening for checking and adjusting the questions. Teachers, trainers and HR teams running compliance training use it to produce quizzes quickly from course material.

What you get out of it

  • Two versions with no extra effort

    Different questions in each version make copying pointless during a test.

  • Questions come from your own material

    Tests are based on the PDF you provide, so they cover what was actually taught.

  • Editable Google Docs

    Both versions are saved as documents you can review, adjust and print or share.

  • An answer key included

    Each version lists the correct answers at the end, which speeds up marking.

How it works

What happens, step by step

  1. Every few minutes ClickRuntime checks your Drive folder for new PDFs.

  2. It skips any PDF it has already turned into tests.

  3. AI reads the material and writes two different sets of multiple-choice questions with answer keys.

  4. Each version is saved as a Google Doc in the same folder.

Before it runs live

  • Connect Google Docs
  • Connect Google Drive

What you get

RunsEvery 30 minutes
Turn PDFs in Drive into two versions of a multiple-choice testtoday, 9:00Succeeded
Google Drive · Test materialChapter 4 Photosynthesis - Test A and Chapter 4 Photosynthesis - Test B created, 10 questions each with answer keys.

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Google Docs and Google Drive steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
tests_from_pdfs_in_drive.pyexample
import io
from pypdf import PdfReader
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, state, ai, report_fetched

FOLDER_ID = "your-test-material-folder-id"

@on_trigger
def run(event):
    creds = Credentials(credentials.connection("google", "work"))
    drive, docs = build("drive", "v3", credentials=creds, cache_discovery=False), build("docs", "v1", credentials=creds, cache_discovery=False)
    seen = set(state.get("seen") or [])
    files = drive.files().list(q=f"'{FOLDER_ID}' in parents and mimeType='application/pdf' and trashed=false", fields="files(id,name)").execute()["files"]
    new = [f for f in files if f["id"] not in seen]
    report_fetched(len(new))
    if not new:
        return {"summary": "Nothing new"}
    for f in new:
        text = "".join(p.extract_text() or "" for p in PdfReader(io.BytesIO(drive.files().get_media(fileId=f["id"]).execute())).pages)[:20000]
        for version in ("A", "B"):
            test = ai.generate(f"Write test version {version}: 10 multiple-choice questions (4 options each) on this material, "
                               f"different from any other version, then an answer key.\n{text}", max_output_tokens=2000).text
            doc = docs.documents().create(body={"title": f"{f['name']} - Test {version}"}).execute()
            docs.documents().batchUpdate(documentId=doc["documentId"], body={"requests": [{"insertText": {"location": {"index": 1}, "text": test}}]}).execute()
            drive.files().update(fileId=doc["documentId"], addParents=FOLDER_ID, removeParents="root").execute()
        seen.add(f["id"])
    state.set("seen", list(seen)[-500:])
    return {"pdfs": len(new)}

FAQ

Common questions

How many questions are in each test?
Ten by default, each with four options. You can choose a different number of questions.
What kind of PDFs work?
PDFs with readable text, such as textbook chapters, handouts and training manuals. Scanned pages without text cannot be read.
Should I check the questions before using them?
Yes. The questions are a strong first draft, but a quick review makes sure each one is accurate and suits your class.
What permissions does it need?
Drive read; Docs write. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Turn PDFs in Drive into two versions of a multiple-choice test” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.