diff --git a/README.md b/README.md index ca7f72b..5421b0e 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,80 @@ # 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. +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. -## Platforms +Everyday use is a **Desktop icon** that opens a browser form (Set → Ink → Serial → Create). +No terminal commands are required for operators. -| Platform | Default backend | Behavior | -|----------|-----------------|----------| -| Windows | `com` | Microsoft Excel via `pywin32`; loads add-ins from `strings.txt`; leaves Excel open | -| Linux / macOS | `ooxml` | Surgical OOXML zip edit; preserves formulas, formatting, queries/connections on disk | +## Quick start (Windows operators) -Force a backend with `--backend com` or `--backend ooxml` (CLI) or the Backend -dropdown in the web UI. +1. One-time setup (IT / first install): install Python 3.12+, clone/copy this project, create a venv, install deps, then double-click + **`desktop\Install-DesktopShortcut.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** -The OOXML path does **not** refresh Power Query, evaluate formulas, or load `.xlam`/`.xla` -add-ins. Open the written file in Excel for refresh/calc. Prefer `com` on Windows when -you need add-ins and a live Excel session. +The Desktop shortcut runs `desktop\XlsxClean.vbs` (no console window) and opens +`http://127.0.0.1:8080`. -## Desktop icon (no commands) +If something fails, use **`desktop\XlsxClean.bat`** instead — it shows a console with errors. -### Option A — shortcut to the installed project (fast) +## Standalone Windows exe (optional) -1. Install the project once (venv + `pip/uv install`). -2. Double-click **`desktop\Install-DesktopShortcut.bat`** (Windows). -3. Use the **XlsxClean** icon on your Desktop. - -That shortcut runs `desktop\XlsxClean.vbs`, which starts the web UI and opens the -browser with no console window. - -Linux: - -```bash -python desktop/install_desktop_shortcut.py -``` - -### Option B — standalone Windows `.exe` (best for other PCs) - -On a Windows machine with Python: +To put a self-contained app on other PCs (build **on Windows**): 1. Double-click **`desktop\build_windows_exe.bat`** -2. It builds `dist\XlsxClean\XlsxClean.exe` and places an **XlsxClean** Desktop shortcut -3. Copy the whole `dist\XlsxClean\` folder to other PCs if needed (keep the folder together) +2. It creates `dist\XlsxClean\XlsxClean.exe` and a Desktop shortcut +3. Copy the whole **`dist\XlsxClean\`** folder when moving to another machine (keep files together) -> The Windows `.exe` must be built **on Windows**. This Linux/cloud environment cannot -> produce a native Windows executable. +## What the app does -Troubleshooting launcher (shows a console): `desktop\XlsxClean.bat` +| 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 | -## Interfaces +### Excel backends -### Web UI (NiceGUI) +| 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) + +```bash +# from the project root +python -m venv .venv + +# Windows +.venv\Scripts\pip install -e . + +# Linux / macOS +.venv/bin/pip install -e . +# or: uv pip install -e . -p .venv/bin/python +``` + +Then create the Desktop shortcut: + +- **Windows:** double-click `desktop\Install-DesktopShortcut.bat` +- **Linux:** `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 xlsx-clean-web @@ -57,9 +82,7 @@ xlsx-clean-web python -m xlsx_clean.web_app ``` -Opens `http://127.0.0.1:8080` (bind address/port: `--host`, `--port`). - -### CLI +**CLI** ```bash xlsx-clean @@ -67,11 +90,23 @@ xlsx-clean python -m xlsx_clean.clean_cells --backend ooxml ``` -On Windows, `src/xlsx_clean/new_xslx.bat` runs the CLI module entry point. +Windows CLI helper: `src\xlsx_clean\new_xslx.bat` -## Config +## Config files -- `src/xlsx_clean/file_data.csv` — product dirs, filename patterns, cells to clear/set -- `src/xlsx_clean/strings.txt` — prompts + Windows add-in paths (COM only) -- `XLSX_CLEAN_ROOT` — optional root that replaces `D:\OpenCloud` in CSV paths - (example: `export XLSX_CLEAN_ROOT=/mnt/opencloud`) +| 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/Install-DesktopShortcut.bat` | Create Desktop icon (Windows) | +| `desktop/XlsxClean.vbs` | Silent double-click launcher | +| `desktop/XlsxClean.bat` | Launcher with visible console | +| `desktop/build_windows_exe.bat` | Build standalone `XlsxClean.exe` | +| `desktop/install_desktop_shortcut.py` | Create Desktop shortcut (Linux) | +| `packaging/xlsx_clean.spec` | PyInstaller spec |