A library used to generate a valid QGIS project out of a given XLSForm file.
You can use the library by simply importing:
from xlsform2qgis.converter import XLSFormConverter
converter = XLSFormConverter("input_xlsform.xls")
converter.convert("output_qgis_directory")Or by running from the commandline:
uv run xlsform2qgis ./samples/service_rating.xlsx ./output/
- Clone the repository and enter it's directory:
git clone [email protected]:opengisch/xlsform2qgis.git
cd xlsform2qgis
- This repository uses the pre-commit project. Install it on this project.
pre-commit install
- This repository uses the uv project. Create a new environment.
uv venv
- Manually add the externally managed
PyQt5andqgislibraries to your environment:
ln -s /usr/lib/python3/dist-packages/qgis .venv/lib/python3.12/site-packages/
ln -s /usr/lib/python3/dist-packages/PyQt5 .venv/lib/python3.12/site-packages/
- OPTIONAL Add the
xlsform2qgislibrary system wide in all Python scripts as editable module. This will allow developingxlsform2qgisin parallel with other projects, such as theXLSFormConverter QGIS Plugin.
sudo uv pip install --system --break-system-packages --editable .
If you are using VS Code and want to debug test and debug the project, run:
uv run python3 -m debugpy --listen 5678 --wait-for-client ./src/xlsform2qgis/converter.py ./samples/service_rating.xlsx ./output/
To run all tests:
uv run pytest
To run a specific test:
uv run pytest -k test_converter