Add Setup.bat for one-click Windows uv venv/install/shortcut, switch build_windows_exe.bat to uv, and document uv as the primary install path. Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
118 lines
4.2 KiB
Markdown
118 lines
4.2 KiB
Markdown
# xlsx-clean
|
|
|
|
Create a new QC datasheet from the latest matching workbook: clear configured cells,
|
|
blank notes, write the batch serial, and save under a new `[SERIAL]` name.
|
|
|
|
Everyday use is a **Desktop icon** that opens a browser form (Set → Ink → Serial → Create).
|
|
No terminal commands are required for operators.
|
|
|
|
## Quick start (Windows operators)
|
|
|
|
1. One-time setup (IT / first install): install [uv](https://docs.astral.sh/uv/getting-started/installation/), clone/copy this project, then double-click
|
|
**`desktop\Setup.bat`**
|
|
2. Every day: double-click the **XlsxClean** icon on the Desktop
|
|
3. In the browser form: choose **Set**, **Ink color**, enter **Serial**, click **Create datasheet**
|
|
|
|
`Setup.bat` creates `.venv` with uv, installs the package, and adds the Desktop shortcut.
|
|
The shortcut runs `desktop\XlsxClean.vbs` (no console window) and opens
|
|
`http://127.0.0.1:8080`.
|
|
|
|
If something fails, use **`desktop\XlsxClean.bat`** instead — it shows a console with errors.
|
|
|
|
## Standalone Windows exe (optional)
|
|
|
|
To put a self-contained app on other PCs (build **on Windows**):
|
|
|
|
1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) if needed
|
|
2. Double-click **`desktop\build_windows_exe.bat`**
|
|
3. It creates `dist\XlsxClean\XlsxClean.exe` and a Desktop shortcut
|
|
4. Copy the whole **`dist\XlsxClean\`** folder when moving to another machine (keep files together)
|
|
|
|
## What the app does
|
|
|
|
| Step | Action |
|
|
|------|--------|
|
|
| 1 | Find the latest matching workbook in the product folder |
|
|
| 2 | Clear configured cells / blank notes |
|
|
| 3 | Write the batch serial |
|
|
| 4 | Save as a new file using the `[SERIAL]` name pattern |
|
|
|
|
### Excel backends
|
|
|
|
| Platform | Default | Notes |
|
|
|----------|---------|--------|
|
|
| Windows | `com` | Uses Microsoft Excel + add-ins from `strings.txt`; leaves Excel open |
|
|
| Linux / macOS | `ooxml` | Surgical `.xlsx` edit; keeps formulas, formatting, and queries on disk |
|
|
|
|
Choose the backend in the web UI dropdown, or with CLI `--backend com\|ooxml`.
|
|
|
|
**Limits of `ooxml`:** does not refresh Power Query, calculate formulas, or load `.xlam`/`.xla`
|
|
add-ins. Open the file in Excel afterward for refresh/calc. Prefer **`com` on Windows** when
|
|
you need add-ins and a live Excel session.
|
|
|
|
## First-time install (admins)
|
|
|
|
Uses **uv** (not pip). Install uv once: https://docs.astral.sh/uv/getting-started/installation/
|
|
|
|
**Windows (recommended):** double-click **`desktop\Setup.bat`**
|
|
|
|
**Manual / Linux / macOS** (from the project root):
|
|
|
|
```bash
|
|
uv venv .venv
|
|
uv pip install -e . -p .venv/bin/python # Windows: .venv\Scripts\python.exe
|
|
```
|
|
|
|
Before building the standalone exe, also install packaging extras:
|
|
|
|
```bash
|
|
uv pip install -e ".[desktop]" -p .venv/bin/python
|
|
```
|
|
|
|
Then create the Desktop shortcut (if you did not use `Setup.bat`):
|
|
|
|
- **Windows:** double-click `desktop\Install-DesktopShortcut.bat`
|
|
- **Linux:** `.venv/bin/python desktop/install_desktop_shortcut.py`
|
|
|
|
Optional: set `XLSX_CLEAN_ROOT` if workbooks are not under `D:\OpenCloud`
|
|
(e.g. `set XLSX_CLEAN_ROOT=D:\OpenCloud` or `export XLSX_CLEAN_ROOT=/mnt/opencloud`).
|
|
|
|
## Developer interfaces
|
|
|
|
These are optional; operators should use the Desktop icon.
|
|
|
|
**Web UI**
|
|
|
|
```bash
|
|
.venv/bin/python -m xlsx_clean.web_app
|
|
# Windows: .venv\Scripts\python.exe -m xlsx_clean.web_app
|
|
```
|
|
|
|
**CLI**
|
|
|
|
```bash
|
|
.venv/bin/python -m xlsx_clean.clean_cells --backend ooxml
|
|
```
|
|
|
|
Windows CLI helper: `src\xlsx_clean\new_xslx.bat`
|
|
|
|
## Config files
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `src/xlsx_clean/file_data.csv` | Product folders, filename patterns, cells to clear/set |
|
|
| `src/xlsx_clean/strings.txt` | UI prompts + Windows Excel add-in paths (`com` only) |
|
|
| `XLSX_CLEAN_ROOT` (env) | Replaces the `D:\OpenCloud\...` root in CSV paths |
|
|
|
|
## Project layout (launchers)
|
|
|
|
| Path | Purpose |
|
|
|------|---------|
|
|
| `desktop/Setup.bat` | Windows one-time setup via uv + Desktop shortcut |
|
|
| `desktop/Install-DesktopShortcut.bat` | Create Desktop icon only (Windows) |
|
|
| `desktop/XlsxClean.vbs` | Silent double-click launcher |
|
|
| `desktop/XlsxClean.bat` | Launcher with visible console |
|
|
| `desktop/build_windows_exe.bat` | Build standalone `XlsxClean.exe` with uv |
|
|
| `desktop/install_desktop_shortcut.py` | Create Desktop shortcut (Linux) |
|
|
| `packaging/xlsx_clean.spec` | PyInstaller spec |
|