Skip to main content

Formula-logic analysis for spreadsheets (.xlsx, .xlsm) — the lens-family member that reads the workbook's reasoning, not its data

Project description

spreadsheet-analyser

Formula-logic analysis for spreadsheets — the lens-family member that reads a workbook's reasoning (formulas, dependencies, error cells, named ranges, hygiene smells), not its data.

records-analyser reads .xlsx via pd.read_excelcomputed values only, profiled as a data table. This reads the same bytes through openpyxl with data_only=Falseformula logic: the SUM/IF/VLOOKUP/INDIRECT calls, the cell-dependency graph, the #REF! cells, the =A1*1.075 magic numbers. Because both members ingest .xlsx, this one is explicit-only (auto_routable: false) — .xlsx continues to auto-route to records-analyser by default; invoke spreadsheet-analyser deliberately when you want formula-logic signals.

Install

pip install spreadsheet-analyser

Use

Python:

from spreadsheet_analyser import SpreadsheetAnalyser, SpreadsheetAnalysis

result: SpreadsheetAnalysis = SpreadsheetAnalyser().analyse("budget.xlsx")
print(result.overall_formulas.unique_functions)        # ['IF', 'SUM', 'VLOOKUP']
print(result.overall_formulas.max_nesting_depth)       # 4
print(result.dependencies.circular_references)         # [['Sheet1!A1', 'Sheet1!B1', 'Sheet1!A1']]
print(result.overall_errors.error_cells)               # {'#REF!': 2, '#DIV/0!': 1}

CLI:

spreadsheet-analyser budget.xlsx          # human summary
spreadsheet-analyser budget.xlsx --json   # raw JSON
spreadsheet-analyser serve                # HTTP API on port 8011
spreadsheet-analyser manifest             # capability manifest

HTTP (spreadsheet-analyser serve on port 8011):

curl -F file=@budget.xlsx http://localhost:8011/analyse
curl http://localhost:8011/health
curl http://localhost:8011/manifest

Signals

Per sheet and rolled up across the workbook:

  • Formulas — count, formula-vs-constant ratio, unique functions used, max nesting depth, longest formula, volatile functions (NOW/RAND/OFFSET/INDIRECT), hardcoded magic numbers in formulas (a hygiene smell — =A1*0.15 instead of =A1*TaxRate).
  • Dependencies — cross-sheet references, dependency-chain depth, circular references.
  • Errors#REF! / #DIV/0! / #VALUE! / #N/A / #NAME? / #NULL! / #NUM! cells.
  • Structure — sheet count, used range per sheet, named ranges, tables, charts present.

The family

Part of the lens analyser family — small single-purpose engines that compose via a shared contract (lens-contract).

What you want Use
Spreadsheet data values / profiling records-analyser (default for .xlsx)
Spreadsheet formula logic spreadsheet-analyser (this)
Any file → right engine auto-analyser

Limits

  • .xlsx and .xlsm only for v1 (.ods via odfpy is a possible follow-on).
  • Cycle detection is direct cell→cell only (not via named-range indirection).
  • "Hardcoded magic numbers" is a heuristic (numbers other than 0/1 inside formulas after stripping cell refs) — useful as a hygiene signal, not a definitive smell.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spreadsheet_analyser-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spreadsheet_analyser-0.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file spreadsheet_analyser-0.1.0.tar.gz.

File metadata

  • Download URL: spreadsheet_analyser-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for spreadsheet_analyser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f87345a6b8eb14e6b83411cd8581866e551c36d9b8b5a51ae396398977131dc6
MD5 85c46cf0a5e9e7c8dbcb739479b64ff6
BLAKE2b-256 183cb15855471c649553db6657a523b63cb22c6ddc74851fc04a65ac5ae50674

See more details on using hashes here.

File details

Details for the file spreadsheet_analyser-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spreadsheet_analyser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c37f33a238d33b1f8135e9dcc11f7dbf06434cd4ae4537a8971c4647598925bd
MD5 f99053ea0d4fcccf130b72e9ebcbba06
BLAKE2b-256 bd24174f0d1f0e3158beb3159fdf48693bf33aff38ff6ce1b89a36493bdb11a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page