Open source · Runs in your Google account · No separate server
What is Doc2Form? · How it works · Features · Demos · Setup · Use cases · FAQ · Project structure · Customization · Contributing
Tired of receiving PDFs and Word docs that should've been a Google Form? Same.
Doc2Form is a free, open-source Google Apps Script that uses Gemini AI to turn any PDF or Word file into a fully functional Google Form — or you describe the form in plain English and it builds it for you.
Use it to convert PDF to Google Form, Word to Google Form, or build a form from a plain-English prompt — powered by Gemini AI and the Google Forms API, with no separate server.
No servers. No hosting. No costs beyond the free Gemini API tier. Everything stays inside your Google account. Prefer zero setup? Use the hosted app at doc2form.dev.
The core idea: upload a document or type what you need; Gemini returns structured form data; the Google Forms API creates the form you can edit and share.
- Educators — Turn quiz PDFs, worksheets, and Word tests into Google Forms.
- HR & recruiters — Digitize intake and application PDFs without retyping every field.
- Developers — Generate forms from Apps Script with Gemini; data stays in the deployer’s Google account.
Upload the PDF in your deployed web app (see setup below). Doc2Form sends content to Gemini for structure, then creates the form via the Google Forms API. The same flow works for Word (.docx) files.
Yes. This project is MIT-licensed and free to run; you use your own free Gemini API tier. Processing happens in your Google Workspace context—not on a third-party document host.
Yes. Use the Describe a form tab: type what you need (for example, a feedback survey with scales), and Gemini builds the form structure. That plain English → Google Form path is one of Doc2Form’s strengths.
Upload a document — PDF or Word → Google Form
Describe a form — type what you need in the Describe a form tab → Google Form
┌─────────────────────────────────────────────────────────────────┐
│ YOU │
│ │
│ ┌──────────────┐ OR ┌──────────────────────────┐ │
│ │ 📄 Upload │ │ ✏️ Describe a form │ │
│ │ PDF / Word │ │ "Create a feedback │ │
│ │ │ │ survey with scales..." │ │
│ └──────┬───────┘ └────────────┬──────────────┘ │
└──────────┼────────────────────────────────┼─────────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ Google Apps Script │
│ │
│ .docx → Mammoth.js extracts text │
│ .pdf → sent as base64 binary │
│ │
│ ┌────────────────────────────┐ │
│ │ 🤖 Gemini AI │ │
│ │ Analyzes content → │ │
│ │ Returns structured JSON │ │
│ │ with questions, types, │ │
│ │ options, and settings │ │
│ └────────────┬───────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────┐ │
│ │ 📋 Google Forms API │ │
│ │ Builds the form with │ │
│ │ 11 question types, │ │
│ │ sections, and validation │ │
│ └────────────┬───────────────┘ │
└───────────────────────┼─────────────────────────────────────────┘
│
▼
┌──────────────────────────────┐
│ ✅ Your Google Form │
│ │
│ 📝 Edit link (for you) │
│ 🔗 Share link (for others) │
│ 📋 One-click copy │
└──────────────────────────────┘
| Feature | ||
|---|---|---|
| 📄 | Upload PDF or Word | AI reads it, extracts fields, builds a form |
| ✏️ | Describe in plain English | "Create a 10-question feedback survey" → done |
| 🎯 | 8 ready-made templates | Feedback, RSVP, job application, quiz, and more |
| 📊 | 11 question types | Short answer, scales, grids, dates, dropdowns... |
| 🔗 | Both links returned | Edit link + share link with one-click copy |
| 🆓 | 100% free | No server, no hosting, no costs |
Prefer to skip this? doc2form.dev is a hosted version — no API keys, no deployment, no configuration needed.
- Go to Google AI Studio
- Click Create API Key
- Copy the key — you'll need it in step 3
- Go to Google Apps Script and click New Project
- Delete the default
Code.gscontent - Copy the contents of each file into your project:
| This repo | Apps Script file | How to create |
|---|---|---|
code.gs |
Code.gs |
Replace the default file |
Prompts.gs |
Prompts.gs |
File → New → Script |
Index.html |
Index.html |
File → New → HTML |
appsscript.json |
appsscript.json |
See note below |
To edit
appsscript.json: Click the gear icon (⚙️ Project Settings) → check "Show 'appsscript.json' manifest file in editor" → go back to Editor and edit the file.
- In Apps Script, click ⚙️ Project Settings
- Scroll to Script Properties
- Click Add Script Property
- Set:
- Property:
GEMINI_API_KEY - Value: (paste your key)
- Property:
- Save
- Click Deploy → New deployment
- Click the gear icon → select Web app
- Set:
- Description:
Doc2Form - Execute as: Me
- Who has access: Anyone (or restrict as needed)
- Description:
- Click Deploy
- Authorize the app when prompted
- Copy the web app URL — that's your Doc2Form!
If you prefer working locally with version control:
npm install -g @google/clasp
clasp login
clasp create --type webapp --title "Doc2Form"
clasp push
clasp deploySee .clasp.json.example for the config format.
├── code.gs # Main backend — Gemini API calls, form builder, validation
├── Prompts.gs # Predefined prompt templates (easy to customize)
├── Index.html # Frontend UI — tabs, file upload, templates, results
├── appsscript.json # Apps Script manifest (scopes, runtime config)
├── screenshots/ # README images & demo GIFs (PDF upload + prompt flows)
└── README.md
Open Prompts.gs and add entries to the PROMPT_TEMPLATES array:
{
id: 'mytemplate',
name: 'My Custom Template',
icon: 'star', // Any Material Icons Outlined name
description: 'What this template does',
prompt: 'The full prompt text that describes the form to generate...'
}Icons: browse Material Icons for icon names.
In code.gs, change the model variable:
var model = 'gemini-2.5-flash'; // Fast & capable (default)
var model = 'gemini-2.5-pro'; // More powerful, slower| Type | Google Forms equivalent |
|---|---|
SHORT_ANSWER |
Short text field |
PARAGRAPH |
Long text field |
MULTIPLE_CHOICE |
Radio buttons |
CHECKBOX |
Checkboxes |
DROPDOWN |
Dropdown menu |
LINEAR_SCALE |
1-5 or 1-10 scale |
DATE |
Date picker |
TIME |
Time picker |
MULTIPLE_CHOICE_GRID |
Grid with radio buttons |
CHECKBOX_GRID |
Grid with checkboxes |
SECTION_HEADER |
Page/section break |
- File size: 5 MB max (Apps Script constraint)
- PDF quality: Gemini handles most PDFs well, but heavily scanned/image-based PDFs may produce less accurate results
- Rate limits: The free Gemini API has usage limits — if you hit them, wait a minute and try again
- Google Apps Script quotas: Standard quotas apply
PRs welcome! Some ideas:
- Image-based question support
- Form preview before creation
- Batch processing (multiple files → multiple forms)
- Export form structure as JSON
- Dark mode
| Technology | Role | |
|---|---|---|
| Google Apps Script | Runtime & hosting | |
| Gemini 2.5 Flash | Document analysis & form structuring | |
| Google Forms API | Form creation | |
| Mammoth.js | Word (.docx) text extraction |
MIT — do whatever you want with it. See LICENSE.
If this saved you from another PDF form, consider giving it a star.