Skip to main content

Data lineage analysis for Excel workbooks — formula extraction, dependency graph, step-by-step evaluation, AI documentation

Project description

linexcel

PyPI License: MIT CI

Data lineage analysis for Excel workbooks.

Extracts every formula, groups stretched patterns (R1C1 canonicalization), builds a dependency graph (cells, ranges, defined names, VBA), decomposes composite functions with step-by-step evaluation, and optionally documents calculations via AI.

Global overview

Install

uv

uv add linexcel
# AI documentation (optional)
uv add linexcel[ai]

pip

pip install linexcel
# AI documentation (optional):
pip install "linexcel[ai]"

Note: linexcel depends on formualizer, a Rust-based spreadsheet engine. Prebuilt wheels are available for Linux, macOS, and Windows. If no wheel matches your platform, a Rust toolchain is required to build from source.

Usage

from linexcel import analyze

result = analyze("workbook.xlsx")
result                    # interactive graph in marimo / Jupyter
result.save_html("out.html")     # standalone offline HTML viewer
result.stats              # {totalFormulas, totalNodes, ...}
result.warnings           # list[str]

# AI documentation (optional, requires google-genai):
# Supports "en" (default) or "fr" language for both documentation and UI
docs = result.document(api_key="...", language="en")
result.save_html("out.html", docs=docs, language="en")

# Workbook-level overview, shown in the separate overview tab:
workbook_doc = result.document_workbook(api_key="...", language="en")
result.save_html("out.html", docs=docs, workbook_doc=workbook_doc, language="en")

Workbook context and screenshots

result.workbook_context extracts bounded first rows and columns for every sheet, without assuming a header row. It also exposes comments, merged cells, frozen panes, hidden columns, and sheet visibility using openpyxl; Excel is not launched.

These structural details are automatically rendered in a structured summary list within the Workbook overview tab of the HTML report.

You can also generate and embed high-resolution sheet screenshots using LibreOffice Calc:

# 1. Render one PNG per printed workbook page
screenshots = result.save_screenshots("screenshots/")

# 2. Map pages to sheet names to display them inline under each sheet card
sheets_screenshots = {
    "Ventes": screenshots[0:3],
    "Synthese": [screenshots[3]],
    "Params": [screenshots[4]]
}

# 3. Embed them directly inside the offline HTML report
result.save_html("out.html", screenshots=sheets_screenshots)

Screenshots require LibreOffice and Poppler's pdftoppm installed on the system (e.g. on Debian/Ubuntu: sudo apt install libreoffice-calc poppler-utils). Rendering runs via LibreOffice headless, without opening a desktop Excel application.

AI data handling

AI documentation is opt-in. Calling result.document() sends a deterministic dossier for each requested node, while result.document_workbook() sends a workbook-level dossier, to the configured Gemini model. The dossiers can include formulas, computed values, precedent/dependent labels, formula decomposition, sheet structure, defined names, and extracted VBA code. Do not enable this feature for a workbook whose contents must remain local, unless its data-sharing requirements permit processing by Google. See the Google Generative AI Terms of Service.

Features

  • Formula extraction via formualizer (Rust engine)
  • Stretched pattern grouping — 1000 identical formulas → 1 node
  • Dependency graph — cells, ranges, defined names, VBA procedures
  • Step-by-step evaluation — each operator/function evaluated individually
  • Standalone HTML viewer — Cytoscape.js embedded, fully offline
  • AI documentation — Gemini generates provable docs from deterministic lineage

Sample output

Global overview

Global overview

Global overview (node selected)

Sample doc

Sample Doc

Security

Please report vulnerabilities privately according to SECURITY.md. Do not include sensitive workbooks or credentials in public issues.

Changelog

See CHANGELOG.md.

License

MIT — see LICENSE.

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

linexcel-0.4.0.tar.gz (3.0 MB view details)

Uploaded Source

Built Distribution

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

linexcel-0.4.0-py3-none-any.whl (265.4 kB view details)

Uploaded Python 3

File details

Details for the file linexcel-0.4.0.tar.gz.

File metadata

  • Download URL: linexcel-0.4.0.tar.gz
  • Upload date:
  • Size: 3.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for linexcel-0.4.0.tar.gz
Algorithm Hash digest
SHA256 afe671ab8edf84f36769411ca16174f1584c6597dab7501003168097d08de74e
MD5 252a875ef6ce1cd0a7fbf73257eb93c5
BLAKE2b-256 2a5031240553254f106c2f7b8781ef95201e66265f57061ba3e425f293144d0e

See more details on using hashes here.

File details

Details for the file linexcel-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: linexcel-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 265.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for linexcel-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83fc7b1c3bf6ac4bd542a5c57972d0f349619971fb9dcc4adc2dfca22aea1325
MD5 a72954ca5da36975b2dab2a3cf60fe08
BLAKE2b-256 1a304446a2e4091007450bb525c3b4c4554a239637457b41932933c2e8aa930f

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