234 lines
3.3 KiB
Markdown
234 lines
3.3 KiB
Markdown
# Weekly Crew Schedule Generator
|
||
|
||
A small Python utility that generates a **weekly crew scheduling workbook** (`.xlsx`) for **Monday–Friday**.
|
||
Each day gets its own sheet with **time slots** and **one column per crew lead / supervisor**.
|
||
|
||
The workbook is designed to be:
|
||
|
||
* **Easy to edit**
|
||
* **Clean when printed**
|
||
* **Simple to export to PDF**
|
||
|
||
This is useful for scheduling **customer visits, job assignments, or crew work plans**.
|
||
|
||
---
|
||
|
||
# Features
|
||
|
||
* Generates **one sheet per weekday**
|
||
|
||
* Monday
|
||
* Tuesday
|
||
* Wednesday
|
||
* Thursday
|
||
* Friday
|
||
|
||
* Configurable via `config.json`
|
||
|
||
* Start time
|
||
* End time
|
||
* Slot size (minutes)
|
||
* Crew / supervisor names
|
||
|
||
* Default schedule:
|
||
|
||
* **08:00 → 17:00**
|
||
* **60 minute slots**
|
||
|
||
* Clean printable layout
|
||
|
||
* Works with:
|
||
|
||
* **LibreOffice Calc**
|
||
* **Microsoft Excel**
|
||
* **OnlyOffice**
|
||
|
||
* Easily **exportable to PDF**
|
||
|
||
---
|
||
|
||
# Example Layout
|
||
|
||
```
|
||
-----------------------------------------------------------
|
||
| Time Slot | Crew 1 | Crew 2 | Crew 3 | Crew 4 | Crew 5 |
|
||
-----------------------------------------------------------
|
||
| 08:00-09:00 | | | | | |
|
||
| 09:00-10:00 | | | | | |
|
||
| 10:00-11:00 | | | | | |
|
||
| ... |
|
||
-----------------------------------------------------------
|
||
```
|
||
|
||
Each **row** represents a time slot.
|
||
Each **column** represents a crew lead or supervisor.
|
||
|
||
You can write things like:
|
||
|
||
```
|
||
Customer Name
|
||
Address
|
||
Notes
|
||
```
|
||
|
||
inside each cell.
|
||
|
||
---
|
||
|
||
# Requirements
|
||
|
||
Python **3.8+**
|
||
|
||
Python package:
|
||
|
||
```
|
||
openpyxl
|
||
```
|
||
|
||
Install it with:
|
||
|
||
```
|
||
pip install openpyxl
|
||
```
|
||
|
||
---
|
||
|
||
# Project Structure
|
||
|
||
```
|
||
crew_schedule/
|
||
│
|
||
├─ generate_week_schedule_xlsx.py
|
||
├─ config.json
|
||
├─ README.md
|
||
```
|
||
|
||
---
|
||
|
||
# Configuration
|
||
|
||
Edit `config.json` to define crews and schedule hours.
|
||
|
||
Example:
|
||
|
||
```json
|
||
{
|
||
"start_time": "08:00",
|
||
"end_time": "17:00",
|
||
"slot_minutes": 60,
|
||
"crews": [
|
||
"Crew 1",
|
||
"Crew 2",
|
||
"Crew 3"
|
||
]
|
||
}
|
||
```
|
||
|
||
## Example With Named Supervisors
|
||
|
||
```json
|
||
{
|
||
"start_time": "07:00",
|
||
"end_time": "16:00",
|
||
"slot_minutes": 60,
|
||
"crews": [
|
||
"Mike",
|
||
"Sara",
|
||
"John",
|
||
"Chris",
|
||
"Dana"
|
||
]
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
# Usage
|
||
|
||
Generate the schedule for the **current week**:
|
||
|
||
```
|
||
python generate_week_schedule_xlsx.py
|
||
```
|
||
|
||
Generate a specific week:
|
||
|
||
```
|
||
python generate_week_schedule_xlsx.py 2026-03-09
|
||
```
|
||
|
||
The script automatically aligns the provided date to **Monday**.
|
||
|
||
---
|
||
|
||
# Output
|
||
|
||
Example output file:
|
||
|
||
```
|
||
weekly_schedule_2026-03-09.xlsx
|
||
```
|
||
|
||
Inside the workbook:
|
||
|
||
```
|
||
Monday
|
||
Tuesday
|
||
Wednesday
|
||
Thursday
|
||
Friday
|
||
```
|
||
|
||
Each sheet contains:
|
||
|
||
* Time slots
|
||
* Crew columns
|
||
* Large writable cells
|
||
|
||
---
|
||
|
||
# Exporting to PDF
|
||
|
||
### LibreOffice
|
||
|
||
1. Open the `.xlsx` file
|
||
2. Fill in the schedule
|
||
3. Click:
|
||
|
||
```
|
||
File → Export As → Export as PDF
|
||
```
|
||
|
||
### Microsoft Excel
|
||
|
||
```
|
||
File → Export → Create PDF/XPS
|
||
```
|
||
|
||
---
|
||
|
||
# Customization Ideas
|
||
|
||
Possible improvements:
|
||
|
||
* Color coding for crews
|
||
* Customer / Supervisor / Notes sub-lines
|
||
* Automatic job numbering
|
||
* Multiple weeks generated at once
|
||
* Direct PDF generation
|
||
* ICS calendar export
|
||
|
||
---
|
||
|
||
# License
|
||
|
||
MIT License
|
||
|
||
Use freely, modify freely.
|
||
|
||
---
|
||
|
||
# Author
|
||
|
||
Internal scheduling utility designed for **crew-based weekly planning**.
|