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.
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
Every few minutes ClickRuntime checks your Drive folder for new PDFs.
It skips any PDF it has already turned into tests.
AI reads the material and writes two different sets of multiple-choice questions with answer keys.
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
Build your own
Need it to work differently?
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
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?
What kind of PDFs work?
Should I check the questions before using them?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Score CVs in a Drive folder and keep a ranked report Doc
Every CV you drop into your Applicants folder is scored against the job description and added to a ranked summary in a Google Doc.
See how it worksCreate document drafts from new contract PDFs in Drive
Each contract PDF added to your Drive folder produces a draft from your Doc template with the parties, dates and amounts filled in.
See how it worksGet a Slack summary of each new doc in a Drive folder
Every document that lands in your Drive Inbox folder is summarised and the summary is sent to you in Slack.
See how it worksKeep exploring
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.