Skip to main content

spreadsheet-guard

A standalone, read-only preservation gate for .xlsx and .xlsm files.

Compare an original workbook with a candidate produced by an agent, script, or library. spreadsheet-guard audits OOXML structure, formulas, cached values, and feature relationships without modifying either input. It emits deterministic JSON and automation-friendly exit codes.

  • MIT licensed
  • No proprietary runtime or service dependency
  • Local files only
  • Fail-closed on invalid or incomplete evidence

Install and audit

Requires Python 3.11 or newer.

pip install spreadsheet-guard
spreadsheet-guard before.xlsx after.xlsx --output preservation-report.json

The command writes the complete report to preservation-report.json and a one-line summary to stdout:

{"report": "preservation-report.json", "schema_version": 1, "status": "passed"}
Status Exit code Meaning
passed 0 Every configured preservation dimension passed.
failed 1 At least one configured dimension found a regression.
unassessed 1 Required evidence was unavailable or a dimension was disabled.
error 2 Inputs, policy, or execution were invalid.

Run the checked-in proof

From a clone of this repository, these commands target bash or zsh and use repo-relative paths:

uv sync

uv run spreadsheet-guard \
  examples/formula-integrity/before.xlsx \
  examples/formula-integrity/after-intact.xlsx \
  --output /tmp/spreadsheet-guard-passed.json

uv run spreadsheet-guard \
  examples/formula-integrity/before.xlsx \
  examples/formula-integrity/after-formula-damaged.xlsx \
  --output /tmp/spreadsheet-guard-failed.json

The first command exits 0 with passed. The second exits 1 with failed because SUM(A1:A2) changed to SUM(A1:A1). The frozen reports are checked in at:

This compact proof demonstrates the packaged engine and report contract. It does not establish universal Excel compatibility or business-output correctness.

What it checks

The default policy requires all five dimensions to remain unchanged:

  1. Macro inventory
  2. External-link inventory
  3. Worksheet inventory and names
  4. Formula integrity
  5. OOXML package integrity

Package integrity checks part relationships, XML parseability, cached formula values, and semantic fingerprints for workbook features such as charts, defined names, data validation, conditional formatting, drawings, external links, and pivot-related metadata.

The strict default also reports intentional formula or structural changes. The caller must compare each finding with the intended edit.

Custom policy

Pass --policy policy.json to replace the strict default:

spreadsheet-guard before.xlsx after.xlsx \
  --output preservation-report.json \
  --policy policy.json
{
  "macro_inventory": {"mode": "unchanged"},
  "external_link_inventory": {"mode": "unchanged"},
  "worksheet_inventory": {
    "mode": "unchanged",
    "expected_names": ["Inputs", "Model", "Outputs"]
  },
  "formula_integrity": {"mode": "unchanged"},
  "package_integrity": {"mode": "unchanged"}
}

A custom policy should enumerate all five dimensions when a passed result is required. A dimension set to null is reported as unassessed.

Python API

from pathlib import Path

from spreadsheet_guard import guard_workbooks

outcome = guard_workbooks(
    Path("before.xlsx"),
    Path("after.xlsx"),
    Path("preservation-report.json"),
)
print(outcome.status)

Limits

  • The Guard evaluates preservation. It does not determine whether formulas, assumptions, or business logic are correct.
  • The Guard is read-only. It reports findings and does not repair either workbook.
  • Inputs are limited to OOXML .xlsx and .xlsm workbooks.
  • A clean report applies only to the configured dimensions and the supplied before-and-after pair.

Write with a commit gate

WolfXL applies policy before a workbook write, runs independent verification, and commits only accepted candidates. spreadsheet-guard is the free, read-only audit surface.

License

MIT. See LICENSE.

Metadata

Release files for spreadsheet-guard 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spreadsheet-guard 0.1.0
File Size Uploaded Provenance Actions
spreadsheet_guard-0.1.0.tar.gz 67.0 kB Without provenance Details for spreadsheet_guard-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spreadsheet-guard 0.1.0
File Interpreter ABI Platform Actions
spreadsheet_guard-0.1.0-py3-none-any.whl Python 3 none any Details for spreadsheet_guard-0.1.0-py3-none-any.whl

Total release size: 96.6 kB

Release files / spreadsheet_guard-0.1.0.tar.gz

Download URL spreadsheet_guard-0.1.0.tar.gz
Size 67.0 kB
Tags Source
SHA-256 checksum
How to use checksums
577103e9ef4946d021e17fd457646d12318a50574048eca4fc1ac1a05fa4f6e4
BLAKE2b-256 checksum
How to use checksums
bdbbdc69aac93941746342d2ef7ddb0a805bdd1b89d075647141a5b42e6069bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spreadsheet_guard-0.1.0-py3-none-any.whl

Download URL spreadsheet_guard-0.1.0-py3-none-any.whl
Size 29.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef952b474827356d381a1f9e3ddb724f950229ebd7ddd3204940b100ea83e47f
BLAKE2b-256 checksum
How to use checksums
00dba2d8b201466dc9ab2d39483bb9adf85bfe451fd1e44cfc4655796a77d97f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for spreadsheet-guard 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page