excel-form-extractor
Extract checkboxes and dropdowns from Excel files (.xlsx / .xls) — no Excel installation required.
Installation
pip install excel-form-extractor
.xls support requires the optional xlrd extra:
pip install excel-form-extractor[xls]
Python API
from excel_form_extractor import extract
result = extract("survey.xlsx")
# Checkboxes — grouped by row proximity
for group in result.checkboxes:
print(group.group_name, group.sheet)
for cb in group.checkboxes:
print(" ", cb.cell, "✓" if cb.checked else "☐")
# Dropdowns
for dd in result.dropdowns:
print(dd.sheet, dd.cells, dd.source)
# JSON serialisation
import json
print(json.dumps(result.to_dict(), indent=2))
extract() signature
extract(
file_path: str | Path,
*,
sheet: str | None = None, # restrict to one sheet (case-sensitive)
controls: str | None = None, # "checkbox", "dropdown", or None (both)
) -> ExtractionResult
Return types
| Class | Fields |
|---|---|
ExtractionResult |
checkboxes: list[CheckboxGroup], dropdowns: list[Dropdown], .to_dict() |
CheckboxGroup |
group_name, sheet, row, checkboxes: list[Checkbox] |
Checkbox |
cell, checked, label |
Dropdown |
sheet, cells, source |
CLI
xfe file.xlsx
xfe file.xlsx --sheet Sheet1
xfe file.xlsx --controls checkbox
xfe file.xlsx --json # JSON to stdout
xfe file.xlsx --output # save to results/<stem>-<timestamp>.json
xfe file.xlsx --output out.json # save to a custom path
xfe --version
Sample output
============================================================
CHECKBOXES (2 groups, 3 total)
============================================================
Group: "Preferences" [Sheet: Survey, Row 3]
✓ B3
☐ D3
✓ F3
Group: "Row5" [Sheet: Survey, Row 5]
☐ B5
✓ G5
============================================================
DROPDOWNS (1 total)
============================================================
1. Cells: B2 Sheet: Form
Source: "Yes,No,Maybe"
Checkbox detection
Three strategies are applied automatically:
- Boolean cells (
t="b") — checkboxes created in Google Sheets and exported to.xlsx - VML form controls — legacy Excel checkboxes (
.xlsxonly) - xlrd boolean cells —
.xlsfiles via the optionalxlsextra
.xlsfiles: VML form controls and dropdowns are not available (xlrd limitation).
Grouping
Checkboxes in the same row with a column gap ≤ 2 (at most one empty column between them) are placed in the same group. The group name is inferred from the text cell immediately to the left of the first checkbox; falls back to Row{n}.
Project layout
excel_form_extractor/
__init__.py public API: extract(), models
models.py dataclasses: Checkbox, CheckboxGroup, Dropdown, ExtractionResult
_checkbox.py checkbox extraction and proximity grouping
_dropdown.py dropdown extraction
_utils.py shared helpers (cell refs, xlsx internals, text cells)
cli.py CLI entry point (xfe command)
py.typed PEP 561 type marker
sample.py dev utility — regenerates samples/ (python sample.py)
samples/ sample .xlsx files for testing
results/ default output dir for --output
Development
git clone https://github.com/asadani/excel-form-extractor
cd excel-form-extractor
pip install -e ".[dev]"
# Regenerate sample files
python sample.py
# Run tests
pytest
# Lint
flake8 excel_form_extractor
black excel_form_extractor
License
MIT
Metadata
Release files for excel-form-extractor 0.1.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 | |
|---|---|---|---|---|
| excel_form_extractor-0.1.0.tar.gz | 28.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| excel_form_extractor-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.3 kB
Release files / excel_form_extractor-0.1.0.tar.gz
| Download URL | excel_form_extractor-0.1.0.tar.gz |
|---|---|
| Size | 28.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d89742cb0e781e6883f2ac98528e88a152079383128e7d2fbadf24080b6f7c83
|
|
BLAKE2b-256 checksum How to use checksums |
1642558d9e61d35387ccc2bd83c99003161b63f0105c5f8a6a6424ae7dc7688a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / excel_form_extractor-0.1.0-py3-none-any.whl
| Download URL | excel_form_extractor-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9cde12bbb0aeae3af1fe69fb5e90a874d9c0b9a5454e2bbdffacc4ccbf2fce3
|
|
BLAKE2b-256 checksum How to use checksums |
0568d1d983eed785b6465bb8205b7aff8d6cfc9a8619401632b56b2237cd55c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Security for excel-form-extractor 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.