workbooklens README

The project's README from github.com/chenweixin123/workbooklens. As one markdown file: README.md.

WorkbookLens

Deterministic linting, regression testing, semantic diffing, and conservative repair for Excel workbooks.

WorkbookLens 2.4 core scan, test, diff, and direct OOXML repair workflows work locally without Microsoft Excel, LibreOffice, an AI key, or a cloud service. Those normal workflows do not calculate formulas, execute VBA, open embedded objects, or fetch external links. .xlsx files support scan, test, diff, and conservative repair; .xlsm files remain read-only. Formula-derived auto-repair can optionally validate isolated temporary copies with Microsoft Excel (preferred) or LibreOffice, but only after the user explicitly marks the workbook as trusted. The installed application may evaluate WEBSERVICE, data connections, or other workbook-defined behavior, so leave that authorization off for untrusted files; lossless normalization still works and formula candidates are skipped. Local .xls conversion is the same kind of trusted-file-only boundary. Neither path uses a cloud service.

Release status: GitHub Releases are authoritative for source archives and attached artifacts. Version 2.4.0 may not be published to PyPI; use the downloaded wheel or source checkout instructions below unless PyPI explicitly lists that version. Do not assume pipx or uvx can install a GitHub-only release by package name.

What is new in 2.4

What is new in 2.3

What is new in 2.2

What is new in 2.1

What was new in 2.0

For the normal Windows experience, download WorkbookLens-2.4.0-windows-x64-setup.exe and SHA256SUMS from the official GitHub Release. Verify the published checksum before running the installer:

(Get-FileHash .\WorkbookLens-2.4.0-windows-x64-setup.exe -Algorithm SHA256).Hash

The installer uses the current Windows account and does not require administrator access. Its wizard provides the normal Install button, adds WorkbookLens to the Start menu, offers a desktop shortcut by default, and registers a standard entry in Windows Installed apps. Open the Start-menu or desktop shortcut to launch the local WorkbookLens window directly. The application uses pywebview with the Microsoft Edge WebView2 Runtime to render its loopback-only interface; it does not show a console or open an external browser. Closing the desktop window stops its background server cleanly. The language selector offers Chinese and English and remembers the choice locally.

Uninstall from Windows Settings > Apps > Installed apps, or choose Uninstall WorkbookLens in the WorkbookLens Start-menu folder. The installer and application are currently unsigned, so Microsoft SmartScreen may display an unfamiliar-app warning. Download only from the official release and verify the SHA-256 value; do not disable antivirus protection. The installed application exposes the same local scan, repair, report, and optional .xls conversion interface as the portable build.

Windows portable ZIP

The official WorkbookLens-2.4.0-windows-x64-portable.zip is the no-install Windows option. It bundles a 64-bit CPython 3.12 runtime, so users do not need to install Python, uv, Microsoft Excel, LibreOffice, an AI key, or a cloud client. It is a portable folder rather than an installer: it does not request administrator access, modify the registry, create file associations, or add an automatic updater.

Download the ZIP and SHA256SUMS from the official GitHub Release, compare the published SHA-256 value, and extract the complete folder. In PowerShell:

(Get-FileHash .\WorkbookLens-2.4.0-windows-x64-portable.zip -Algorithm SHA256).Hash
Expand-Archive .\WorkbookLens-2.4.0-windows-x64-portable.zip -DestinationPath .\WorkbookLens
Set-Location .\WorkbookLens\WorkbookLens-2.4.0-windows-x64
.\Start-WorkbookLens.cmd

The launcher starts the no-console WorkbookLens.exe desktop application. Its background service listens only on 127.0.0.1, prefers port 8765, and selects an available local port if that port is already in use. The interface opens inside the WorkbookLens window through Edge WebView2 rather than an external browser, and closing the window stops the service cleanly. Workbook files, generated reports, language settings, and diagnostic logs stay on the computer; the portable runtime does not upload them. WorkbookLensCLI.exe remains available in the same folder for command-line workflows.

The local home page also offers Convert to .xlsx for legacy binary .xls workbooks. Conversion is enabled only when WorkbookLens detects Microsoft Excel or LibreOffice on that computer. Excel is preferred for fidelity; LibreOffice is a fallback. Macros and events are disabled for the automated Excel open, external links are not updated, and the generated file must pass the same bounded OOXML safety inspection used by normal WorkbookLens inputs before it is downloaded. Conversion can still change unsupported legacy features, cached formula results, fonts, print layout, or vendor-specific objects, so review the .xlsx copy before relying on it.

The executable is currently unsigned, so Microsoft SmartScreen may display a warning. Verify the checksum and download only from the official release. The portable build guarantees the built-in rules; install the wheel in a normal Python environment when third-party entry-point plugins are required.

Install the downloaded wheel

The .whl attached to the GitHub Release is a local Python application package, not a hosted upload service. Workbook processing stays on the user's computer. Installing the wheel may contact the configured Python package index once to obtain dependencies; scanning, planning, repair, diff, and the loopback web UI do not upload workbooks.

Download workbooklens-2.4.0-py3-none-any.whl, workbooklens-2.4.0.tar.gz, and SHA256SUMS from the official GitHub Release, verify the checksum, and install it with Python 3.11+ and uv.

PowerShell

Get-Content .\SHA256SUMS
(Get-FileHash .\workbooklens-2.4.0-py3-none-any.whl -Algorithm SHA256).Hash
uv tool install .\workbooklens-2.4.0-py3-none-any.whl
workbooklens --version
workbooklens serve --port 8765

Bash

grep -E '  workbooklens-2\.4\.0-py3-none-any\.whl$' SHA256SUMS | sha256sum -c -
grep -E '  workbooklens-2\.4\.0\.tar\.gz$' SHA256SUMS | sha256sum -c -
uv tool install ./workbooklens-2.4.0-py3-none-any.whl
workbooklens --version
workbooklens serve --port 8765

Then open http://127.0.0.1:8765/. The browser page and temporary upload directory are local to that process. Sensitive workbooks should use the CLI or this loopback UI rather than a hosted CI runner.

The setup executable, portable ZIP, and wheel are distributions of the same local application. The installer is the normal Windows option, the portable ZIP makes no installation changes, and the wheel is the extensible option for Python users.

Install from this source checkout

WorkbookLens requires Python 3.11 or newer and uv.

Bash

git clone https://github.com/chenweixin123/workbooklens.git
cd workbooklens
uv sync --locked
uv run workbooklens --version
uv run workbooklens demo --out .artifacts/demo

PowerShell

git clone https://github.com/chenweixin123/workbooklens.git
Set-Location workbooklens
uv sync --locked
uv run workbooklens --version
uv run workbooklens demo --out .artifacts/demo

If PyPI lists version 2.4.0, isolated installation is:

uvx --from workbooklens==2.4.0 workbooklens --help
pipx install workbooklens==2.4.0

Core workflows

# Self-contained HTML, JSON, snapshot, and SARIF
workbooklens scan INPUT.xlsx --out report/

# Optional YAML rule configuration
workbooklens scan INPUT.xlsx --config workbooklens.yml --out report/

# Gate only findings absent from an earlier report
workbooklens scan INPUT.xlsx --baseline previous/findings.json --new-only --fail-on warning --out report/

# Pin a portable logical path when invoking from varying working directories
workbooklens scan INPUT.xlsx --source-scope models/INPUT.xlsx --baseline previous/findings.json --new-only --out report/

# Preview and apply source-bound deterministic repairs to a new file
workbooklens plan INPUT.xlsx --config workbooklens.yml --out repair-plan.json
workbooklens apply INPUT.xlsx repair-plan.json --patch-id patch-0123456789abcdef --out INPUT.fixed.xlsx
workbooklens apply INPUT.xlsx repair-plan.json --safe-only --out INPUT.fixed.xlsx

# Apply lossless repairs and validate unique formula candidates from a trusted workbook
workbooklens apply INPUT.xlsx repair-plan.json --auto-repair --recalc-provider auto \
  --trust-workbook --out INPUT.auto-fixed.xlsx

# Apply an explicitly reviewed layout patch or atomic layout group
workbooklens apply INPUT.xlsx repair-plan.json --patch-id patch-fedcba9876543210 --accept-layout-risk --out INPUT.layout-fixed.xlsx

# Semantic before/after comparison
workbooklens diff BEFORE.xlsx AFTER.xlsx --out diff.html

# Bounded YAML assertions and finding-count gates
workbooklens test INPUT.xlsx --config workbooklens.yml --out test-results.json

# Loopback-only local review UI
workbooklens serve --port 8765

PowerShell uses the same arguments:

workbooklens scan INPUT.xlsx --baseline previous\findings.json --new-only --fail-on warning --out report

--new-only requires --baseline. A findings.json baseline is bound to its source_scope (normally the input path relative to the current directory), so a report for one workbook cannot silently hide a finding in another. Without --new-only, reports retain all current findings while identifying which were already known. Reusing a --new-only report preserves both its new and previously known IDs.

Optional Workbook Profile

Some spreadsheet mistakes cannot be proved from layout alone. An optional version-3 YAML profile lets a user declare field roles, constraints, and repair policy without sending the workbook anywhere:

version: 3
profile:
  infer_semantics: true
  report_trailing_whitespace: true
  review_trailing_whitespace_patches: false
  sheets:
    - sheet: Invoices
      range: A1:G10000
      header_row: 1
      columns:
        - header: Invoice ID
          role: identifier
          repair: report
          required: true
          identifier_width: 8
          preserve_leading_zeros: true
        - header: Status
          role: category
          required: true
          allowed_values: [Open, Paid, Void]
        - header: Customer Email
          role: email
        - header: Amount
          role: currency
          repair: auto
        - header: Tax Rate
          role: percentage
          repair: review

Supported roles are identifier, category, email, phone, currency, percentage, date, number, and text. Select a field by header or bounded Excel column. Version 3 adds repair: auto | review | report: auto still requires a unique parse, stable native peers, no leading-zero risk, and all postconditions; review emits a semantic-review candidate; report never emits a patch. Profile rules report missing required values, invalid enumerations or contact formats, possible lost leading zeros, trailing whitespace, and number-format role conflicts. They never invent business values. Versions 1 and 2 remain readable and retain their earlier beh

workbooklens (chenweixin123/workbooklens)

Searching Database…

这是什么?WorkbookLens 是一款本地优先的工具,可对 Excel 工作簿进行 lint 检查、回归测试、语义对比和保守修复,完全在你的机器上运行,不需要 Excel、LibreOffice、AI 密钥或云服务。
这是桌面应用、命令行工具,还是两者兼有?两者都有:Windows 提供基于 pywebview 构建的带品牌标识窗口应用(WorkbookLens.exe),另有独立的控制台命令行工具(WorkbookLensCLI.exe)和 Python 包,它们在 macOS 和 Linux 上以同样的方式工作。
怎么让它跑起来?在 Windows 上,从 GitHub Release 下载已签名的安装程序或免安装的便携版 ZIP,运行前先核对公布的 SHA-256;在 macOS/Linux 上则使用 Python 包/命令行工具,因为打包的桌面应用仅支持 Windows。
用它需要 Microsoft Excel 或 AI 密钥吗?不需要——核心的扫描、测试、对比和 OOXML 修复流程完全离线运行,不需要 Excel、LibreOffice、AI 密钥或任何云服务;Excel/LibreOffice 仅用于可选地在你明确信任的文件上验证由公式推导出的修复。
实际支持哪些文件类型和操作?xlsx 文件支持完整的扫描、测试、对比和保守修复,xlsm 文件则为只读;公式从不被计算,VBA/嵌入对象/外部链接从不被执行。
我的工作簿数据会去哪里?一切都留在你的电脑上——工作簿、生成的报告、语言设置和诊断日志都不会离开本机,也不涉及任何云服务。
Patch Plan 模式实际上能保证什么?Patch Plan schema v3 会记录候选唯一性、推导证据、保留的不变量和重算要求,因此一旦任何重算、重新扫描、依赖或幂等检查失败,一键修复就会自动回滚。
我能在 CI 里运行 WorkbookLens 吗?可以,GitHub Action 支持扫描或测试模式,可用 YAML 配置并为 xlsx/xlsm 文件提供基线;该项目本身会在 Linux、Windows 和 macOS 上测试 Python 3.11-3.14。
它会执行我文件里的公式或宏吗?不会,常规流程从不计算公式、运行 VBA、打开嵌入对象或获取外部链接——可选的 Excel/LibreOffice 验证只在你明确把工作簿标记为受信任之后才会启用。
转换旧的 .xls 文件呢?本地 .xls 转换遵循与公式自动修复验证相同的仅限受信任文件规则:只对你明确标记为受信任的文件运行,且绝不接触云服务。
Size
1.2 MB
Stars
142
Age
2mo
Commits · 90 Days