gformlib
gformlib is a Python library for creating and managing Google Forms programmatically from JSON configurations. It is a high-level wrapper around the official Google Forms API v1.
Features
- Create Google Forms from a simple Python dict / JSON file
- All question types supported: short answer, paragraph, multiple choice, checkboxes, dropdown, scale, date, time, file upload
- Service-account and OAuth 2.0 authentication
- Full type annotations (PEP 561 compliant)
- Retrieve form responses with automatic pagination
- Professional project structure, ready to publish to PyPI
Installation
pip install gformlib
Quickstart
1. Authenticate with a Service Account (recommended for servers)
from gformlib import GoogleFormsClient
client = GoogleFormsClient.from_service_account("path/to/service_account.json")
2. Authenticate with OAuth 2.0 (desktop / installed apps)
client = GoogleFormsClient.from_oauth_credentials(
"client_secrets.json",
token_file="token.json",
)
3. Create a form from a dict
info = client.create_form(
{
"title": "Customer Satisfaction Survey",
"description": "Tell us how we're doing.",
"questions": [
{
"title": "Your name",
"type": "short_answer",
"required": True,
},
{
"title": "Overall rating",
"type": "scale",
"low": 1,
"high": 5,
"low_label": "Poor",
"high_label": "Excellent",
"required": True,
},
{
"title": "Which features do you use?",
"type": "checkboxes",
"options": ["Dashboard", "Reports", "API", "Integrations"],
},
{
"title": "Any other comments?",
"type": "paragraph",
},
],
}
)
print(f"Form ID : {info.form_id}")
print(f"Share URL : {info.responder_uri}")
4. Read responses
responses = client.list_responses(info.form_id)
for r in responses:
print(r["responseId"], r.get("answers"))
Supported question types
type value |
Google Forms equivalent |
|---|---|
short_answer |
Short answer (single line) |
paragraph |
Paragraph (multi-line) |
multiple_choice |
Multiple choice (radio) |
checkboxes |
Checkboxes |
dropdown |
Dropdown |
scale |
Linear scale |
date |
Date |
time |
Time |
file_upload |
File upload |
Authentication setup
Service Account
- Create a Service Account in Google Cloud Console.
- Enable the Google Forms API and Google Drive API.
- Download the JSON key file.
- Share the target Google Drive folder with the service account email.
OAuth 2.0
- Create an OAuth 2.0 Desktop app client in Google Cloud Console.
- Download
client_secrets.json. - On first run, a browser window opens to authorise access.
- The token is cached in
token.jsonfor subsequent runs.
Development
git clone https://github.com/andhit-r/gformlib.git
cd gformlib
pip install -e ".[dev]"
pytest
Running the full test matrix with tox
tox
Contributing
See CONTRIBUTING.md.
License
Metadata
Release files for gformlib 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gformlib-0.2.0.tar.gz | 27.7 kB | With provenance | Details for gformlib-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gformlib-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for gformlib-0.2.0-py3-none-any.whl |
Total release size: 48.0 kB
Release files / gformlib-0.2.0.tar.gz
| Download URL | gformlib-0.2.0.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42510f7f1b5a9c4f72be10f716bf9c865f4f360ad6834f2ffd16f1a5d902f864
|
|
BLAKE2b-256 checksum How to use checksums |
a4b2585faffd9cd867800e5fa5f72abd735d1306ad0bc0597e95225e4145068c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 23, 2026.
Transparency logRelease files / gformlib-0.2.0-py3-none-any.whl
| Download URL | gformlib-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47359030caba0ba085e8016c8378aa12c6bbf5ff81a995686a38a9dea1423946
|
|
BLAKE2b-256 checksum How to use checksums |
1a31609580314b6ff7f9714817a36ca4c0943c1e5b0a7ff5fc9101b0cf563746
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 23, 2026.
Transparency logSecurity for gformlib 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gformlib-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.