CsvRepairWorkbench is a local-first workbench for scanning, repairing, validating and auditing malformed CSV files. It targets practical CSV failures such as naked quotes inside quoted fields, quotes inside unquoted fields, multiline fields and column-count mismatches.
The project has three parts:
engine/CsvRepairKit: a streaming .NET 8 CSV scanner and repair engine.workbench/api.py: a FastAPI local API that runs engine jobs and serves JSONL/CSV/report previews.web: a bilingual React/Vite UI for batch tasks, progress, issue grouping, repair preview and highlighted before/after diffs.
- Scan one CSV or a whole directory recursively.
- Repair one CSV, selected issue files, or a full scan scope without overwriting source files. Single-file repair writes
<name>_repaired.csvbeside the input CSV when--outputis omitted. - Keep issue logs, change logs, summary CSV files, progress JSONL and JSON reports.
- Preview repair changes before formal repair from scan rows, with highlighted original and projected repaired tokens.
- Upload a CSV through the UI instead of manually typing a path.
- Switch between Chinese and English in the UI.
- .NET SDK 8.0 or newer.
- Python 3.10 or newer.
- Node.js 20 or newer.
From the repository root:
dotnet build .\engine\CsvRepairKit\CsvRepairKit.csproj -c Release
python -m pip install -r .\workbench\requirements.txt
npm --prefix .\web installStart the local API:
.\scripts\start-api.ps1Start the web UI:
.\scripts\start-web.ps1Open http://127.0.0.1:5173.
Scan one CSV:
dotnet .\engine\CsvRepairKit\bin\Release\net8.0\CsvRepairKit.dll scan --input .\samples\malformed.csv --output-dir .\outputs\scan --log-all-issuesRepair one CSV:
dotnet .\engine\CsvRepairKit\bin\Release\net8.0\CsvRepairKit.dll repair --input .\samples\malformed.csv --log-all-changesValidate a repaired CSV:
dotnet .\engine\CsvRepairKit\bin\Release\net8.0\CsvRepairKit.dll validate --input .\outputs\malformed_repaired.csvThe web UI is static and can be deployed to Cloudflare Pages or any static host. File scanning and repair require the local FastAPI service because browsers cannot directly read arbitrary local folders.
By default, the local API only allows local development origins such as http://127.0.0.1:5173. If you intentionally use the hosted UI with a local API, start the API with an explicit origin allowlist:
$env:CSV_REPAIR_ALLOWED_ORIGINS = "https://csv-repair.simplezion.com"
.\scripts\start-api.ps1Modern Chrome and Edge may also ask for local network or loopback access when a hosted HTTPS page talks to 127.0.0.1. Grant that permission only for a hosted UI you trust.