Skip to main content

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

Project description

linexcel

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.

Install

uv

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

pip

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

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

Security

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

Sample output

Global overview

Global overview

Global overview (node selected)

Sample doc

Sample Doc

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.3.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.3.0-py3-none-any.whl (265.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: linexcel-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 06b136e0bac3be6a3f05756a6ab66a2eac0eb1ba13af5c46b1aff5faf4f111d1
MD5 39081f59592ecf0bf7f0f0f86ff66099
BLAKE2b-256 e7f8cda6dae58037b5f1ef49f2028093599ad3fc916f0d849114182a128d4b28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: linexcel-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 265.0 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77252910ee05932797f665b8597fd7e1ffbe5cf4a13794b76ec02f4b67933aea
MD5 301f124886e86c867bd291ba847db974
BLAKE2b-256 dbb8126ec331d2cb3b054594b02dd08f5a78e171033575824f8365ce5a3b7a0d

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