spreadsheetforms

raw JSON →
0.5.0 verified Sat May 09 auth: no python

Tools for creating, extracting submitted data from, and filling spreadsheet-based forms. Current version 0.5.0, requires Python >=3.7. Release cadence is irregular.

pip install spreadsheetforms
error ModuleNotFoundError: No module named 'spreadsheet_forms'
cause Trying to import with hyphen instead of underscore.
fix
Change import to 'import spreadsheetforms' (no hyphen).
error AttributeError: 'Form' object has no attribute 'data'
cause Attempting to access `form.data` without extracting data during load.
fix
Use form = Form.from_file('file.xlsx', extract_data=True). Data is stored as form.data after extraction.
gotcha The package name contains a hyphen (spreadsheetforms) but the module import uses an underscore (spreadsheetforms). PyPI does not enforce naming consistency.
fix Use 'pip install spreadsheetforms' but 'import spreadsheetforms'.
breaking Version 0.4.0 changed the API for extracting submitted data: `Form.from_file()` now requires `extract_data=True` to parse data; previous versions extracted automatically.
fix Call `Form.from_file('submission.xlsx', extract_data=True)` to get form with data.
gotcha Form.to_file() overwrites existing files without warning. No prompt or backup is created.
fix Check file existence before calling to_file or ensure you have backups.

Create a basic form template and write it to an Excel file.

from spreadsheetforms import Form
from spreadsheetforms.sheets import SheetSpec

# Define a simple form
form = Form(
    sheets=[
        SheetSpec(
            name='Questions',
            columns=['Question', 'Answer']
        )
    ]
)

# Generate a blank spreadsheet
form.to_file('my_form.xlsx')