A Python tool that generates printable PNG cards from Excel data.
The script reads address data, “do not visit” entries, and optional extra notes from an Excel workbook and creates one PNG card per Gebiet.
- Reads data from an Excel file with multiple sheets
- Generates one PNG card per area /
Gebiet - Supports merged Excel cells
- Handles apartment ranges such as
1-100 - Calculates total number of apartments per area
- Adds a separate “Bitte NICHT besuchen” section
- Supports optional extra information from an
Extrassheet - Automatically adjusts long house numbers to fit into the table
- Saves all generated cards as PNG files
.
├── generate_cards.py # Main script
├── requirements.txt # Python dependencies
├── .gitignore # Files ignored by Git
└── README.md # Project documentation
The script expects an Excel workbook with the following sheets:
Main address data.
Expected columns:
| Column | Description |
|---|---|
Gebiet |
Area number |
Straßen Name |
Street name |
Haus |
House number |
Stiegen |
Staircase / building section |
Parteien |
Apartments / units |
Parteien_calc |
Optional calculated apartment count |
Addresses that should not be visited.
Expected columns may include:
| Column | Description |
|---|---|
Gebiet |
Area number |
Straßen Name |
Street name |
Haus |
House number |
Stiegen |
Staircase |
Parteien |
Apartment / unit |
Top |
Apartment number |
Text |
Optional ready-made text line |
Optional additional notes.
Expected columns:
| Column | Description |
|---|---|
Gebiet |
Area number |
Text |
Additional note |
- Clone this repository:
git clone https://github.com/YOUR_USERNAME/gebiet-card-generator.git
cd gebiet-card-generator- Install dependencies:
pip install -r requirements.txtOpen generate_cards.py and change the Excel file path:
EXCEL_FILE = "C:\\sample_data.xlsx"Then run:
python generate_cards.pyThe generated PNG files will be saved in the output folder.
The script creates files like:
output/Gebiet_1.png
output/Gebiet_2.png
output/Gebiet_3.png
Each card contains:
- the Gebiet number,
- a table with street, house, staircase and apartment information,
- calculated total number of apartments,
- optional extra notes,
- a “Bitte NICHT besuchen” section.
- Python
- pandas
- openpyxl
- Pillow
-
Move settings to a separate config file
-
Add command-line arguments
-
Add a graphical user interface
-
Export cards as PDF
-
Add sample Excel data
-
Add automated tests

