Skip to content

Command line

Everything the Python API does deterministically, without writing any Python:

uvx linexcel analyze workbook.xlsx

uvx runs it without installing anything. Installed in a project, the same command is available as linexcel, or as python -m linexcel when the console script is not on PATH:

uv add linexcel                 # pip install linexcel
uv run linexcel analyze workbook.xlsx

Deterministic by default: nothing contacts a model unless you ask for it.

Output

Writing <workbook>_lineage.html next to the workbook is the default.

Option
-o, --output PATH Where the HTML goes. - writes to stdout.
--json PATH Also write the graph as JSON. - writes to stdout.
--no-html Skip the viewer. Use with --json.
--language {en,fr,es,de,it,pt,nl,ja,zh} Interface and AI prompt language (default en). See Languages.

Progress, statistics and warnings go to stderr, so - is safe to pipe:

linexcel analyze workbook.xlsx --json - --no-html | jq '.meta.stats'

Before committing to a long run

--dry-run inspects declared dimensions, external links and extraction ceilings. Declared dimensions are not occupied-cell counts, and file size cannot predict execution time. No ETA is displayed.

linexcel analyze workbook.xlsx --dry-run
linexcel analyze workbook.xlsx --analysis-seconds 120 --memory-mb 2048 -v

Normal analysis is isolated with a configurable 120-second budget. AI, screenshots and export have separate limits. --time-budget remains the cooperative decomposition limit, not the hard analysis deadline. See execution budgets for statuses, compatibility and platform memory semantics. Interrupted CLI analyses export diagnostics with exit code 3; cancellation exits 130 without starting optional stages.

Trace only the outputs you need

For a large workbook, start with the result you want to explain:

linexcel analyze workbook.xlsx --target "Summary!B4" -o summary.html

Trace several outputs by repeating the option. Quote references containing spaces; for sheet names containing commas, keep Excel's inner single quotes:

linexcel analyze workbook.xlsx --target "Summary!B4" --target "Summary!B8"
linexcel analyze workbook.xlsx --target "'Costs, FY26'!A1" -o costs.html

Replace these example references with cells in your workbook. Each target must be a sheet-qualified single cell, not a range. The analysis follows static upstream dependencies across sheets without requesting global recalculation. It does not guarantee selective loading or a fixed reduction in memory use. Dynamic references and truncated traces can omit dependencies from the graph; check the report's warnings.

To explore a complete report one worksheet at a time, use its Graph sheet selector. That is a display filter, not a CLI option for excluding worksheets from analysis.

Watching it run

--verbose draws progress per sheet through the two phases that take the time, reading the values the file stores and sweeping it for formulas, then prints what each phase cost. It writes to stderr, so it never mixes into -o - or --json -, and it draws bars only when stderr is a terminal: a CI log gets one plain line per phase instead of thousands of redraws.

Install linexcel[progress] for the bars. Without it the same phases and the same timings are printed unadorned; nothing else changes.

The exit status is 0 on success, 2 on a failure the tool recognises (an unreadable workbook, a contradictory pair of options), and 130 on Ctrl-C.

What goes into the graph

Option
--refs-dir DIR Folder holding the workbooks this one links to, and the add-ins whose VBA it calls. Without it a cell reading another file is named, never resolved. See Other workbooks.
--screenshots DIR Render each sheet to a PNG and show it in the report. Needs LibreOffice and Poppler; see Screenshots.
-v, --verbose Progress while it runs, and per-phase timing, on stderr.
--time-budget SECONDS Ceiling on the step-by-step decomposition (default 300). Past it, cells keep their values and lose only their breakdown, and the report says so.
--target SHEET!A1 Trace the static upstream lineage of this cell without requesting global recalculation. Repeatable; comma-separated cells are accepted, with Excel quotes around sheet names containing commas ('Costs, FY26'!A1). Only relevant names, VBA and Power Query context remain. Dynamic references (INDIRECT/OFFSET) or a truncated trace can cause the engine to evaluate dependencies omitted from the graph; the report states this limitation.
--dry-run Say what the file declares: sheets, declared size, linked workbooks and the ceilings that will apply. Stop without analysing it.

Lazy application

uvx linexcel serve --open --port 8765

Use uv run linexcel serve from a development checkout. --open opens the default browser while retaining a copyable terminal URL. --port 0 chooses a free port and prints its actual address. Invalid ports fail before creating workspace storage; an occupied port suggests selecting another port. Closing the browser leaves the server running; stop it with Ctrl+C.

Standalone serve keeps projects until you delete them. Use --retention-days N only when you want automatic expiry. The private local profile lives in --data-dir (default ~/.linexcel); keep this directory to retain your workspace across server restarts. A newly opened browser uses the single-use link printed by serve. To reconnect another browser while the server is running, use:

linexcel session-link --data-dir ~/.linexcel
linexcel doctor --data-dir ~/.linexcel --ai --ai-model qwen3.8

The session link expires after ten minutes. doctor checks installed tools, storage and configured model discovery without generating documentation. Model discovery does not establish that image analysis works.

serve reads the machine to set its resource limits and prints them at startup. These options replace a limit:

Option Default
--memory-mb N Half of the physical memory in whole GiB, at least 2,048 Memory in MiB that all running operations may request together. One operation cannot request more.
--max-storage-mb N Space used, plus free space minus a reserve Disk space in MiB for all workspaces, their indexes and results. The reserve is 10% of the disk and at most 10 GiB.
--max-upload-mb N 256 Size in MiB of one import, references included.
--import-seconds N 3,600 Default duration in seconds of an import, a graph construction, sheet captures or a report, from 1 to 3,600. The Long operations field of the settings starts at that value.
--workers N 2 Operations that run at the same time.

doctor accepts --max-storage-mb with the same default. For the cost of a large import and the message that each limit produces, see Open a large workbook in the web application.

The workspace actions provide an archive download and restoration. An archive contains the workbook, supplied references, retained results and captures; it excludes browser credentials and indexes. Restoration creates a new project and rebuilds its index. Prior results remain historical evidence and are not reused as current calculations. Keep archives private when their sources are private. Older browser-owned projects can be recovered explicitly from the local workspace; recovery preserves the original project.

The disk index

Each project keeps its structural index in index-v5.sqlite (index schema 5). Formulas, names, ranges and any unusual cell keep one record each. A literal value that can be rebuilt exactly is stored as one value in a row of its sheet's grid instead of a compressed record with three SQLite indexes on top. Reading a cell gives back the same node as before, field by field, with one exception: the provenance of a stored value is now its sheet (workbook SHA-256, worksheet part, sheet state) plus the value, and the XML spelling of the number or the shared-string index (rawXmlValue) is no longer kept for grid cells. Formula caches and cells kept as records still have it.

Measured on the public corpus (Windows, quiet machine): the index of the DGT election table (103 MB of workbook, 18.1 million values, no formula) takes 92 MB and imports in 569 s; the ONS population tables (50 MB, 11.2 million values) 26 MB in 321 s; the generated fpna model (20 MB, 2.5 million values and 175,000 formulas) 357 MB in 188 s, of which 230 MB are its formulas. Schema 4 needed 10,969 MB, 6,717 MB and 2,022 MB. The Data tab still copies every cell into a database of its own: 9,830 MB for DGT and 6,027 MB for ONS, prepared in 585 s and 390 s. When the storage quota is smaller than that copy, the preparation stops on the quota and the tab says so. The launcher takes its default quota from the free disk space, and --max-storage-mb sets another one. When the preparation completes, the Excel presentation still refuses sheets this large (its size limit).

A project imported by an earlier version keeps its old index.sqlite on disk, unused: the project shows "Index created by an earlier version of linexcel: reimport the workbook (the file is kept)" with a reimport button, every view that reads the index says the same, and library search leaves the project out. Nothing is deleted when the server starts. Launching the reimport deletes the old index and the graph and data views built from it, then builds the new index from the kept workbook. Archives never contained indexes, so an archive made by either version restores and reimports.

An import publishes what it does within its budgets. Its own work ends 5 s before the end of the time budget, counted from the server's start of the task; those seconds are kept for links, VBA, counts and publication (measured on the corpus at 0.07 to 0.40 s after the last phase, 1.2 to 2.2 s with the worker's start and exit, the election table included). That end grows with the formulas read (about 7 µs a formula: 1.2 s for 150,000 formulas, 3.3 s for 450,000; 1,000,000 formulas overran 5 s and the task timed out; 7.6 s once the margin let it finish), so the margin is 20 µs a formula read when that is more than 5 s: 20 s for a million formulas. Reading sheets may use half of the storage left when the import starts. Reading stops before a sheet, or after every 10,000 cells, as soon as the time left no longer covers the predicted analysis of the formulas of the sheets already read whole at its fastest: 0.30 ms a formula, the fastest rate measured, with no margin. Reading thus stops only when that analysis could not fit even at best; a slower analysis is covered by the safety net below. With the earlier reserve, 1.25 x 0.65 ms, the public energy model (233,410 formulas, analyzed at 0.41 to 0.52 ms) stopped reading with 29 to 40 % of its budget unused and whole sheets not imported. The formulas of the sheet being read are not counted: it is read as long as the sheets before it stay covered, and its formulas are then analyzed as far as time allows, the rest marked "not analyzed" (below), rather than rolling back a sheet that could be read. A sheet of values alone may therefore use most of the budget. The sheet the import stops in is rolled back; it and the following sheets are marked "Sheet not imported" in Diagnostics, with the reason. A formula reading such a sheet is refused: its cells are unknown, never blank. A memory stop still ends the import without an index.

The formula analysis that follows checks the deadline before each formula. The formulas it does not reach keep the diagnostic "Formula not analyzed": their saved values, when the file holds them, are still shown, their sources are unknown, and a calculation reaching one is refused; formulas analyzed that read only values are calculated. Their sheets are published as partial for the time budget, with the number of formulas not analyzed. Every formula and defined name carries that diagnostic from the moment it is read until it is analyzed, so nothing is written at the deadline and every view of the node sees it. Data regions are described only for the sheets whose predicted description (1.25 x 5.5 µs a saved value) ends before the deadline; the others are listed as "Data regions skipped: budget", with every value and formula complete. This rate, like the final 5 s, stays cautious: a region description cannot be stopped once started, and running past the end of the task would publish nothing. On the public election table it predicted 125 s for 64 s measured and skipped the regions with 73 s left. In a partial import, the uses listed for a cell can miss a formula not imported or not analyzed; the banner, the node list and the Data tab say that the import is partial.

When time cut the import, Diagnostics says what stopped (reading, analysis, regions) and proposes a reimport with a budget that counts the whole import: the reading time and the formulas and values found, extrapolated from the share of worksheet XML read; the analysis of every formula and the regions, at the rates measured on this import when it analyzed at least 2,000 formulas or described at least 10,000 values, else at the cautious rates above; links and VBA as measured. The total plus 25 % and the final 5 s, and never less than what the reimport's own reading check needs to read every sheet (the time before reading, the whole reading and the reserve of every formula, plus the final 5 s), is rounded up to the minute, at least a minute more than the budget used, at most 3600 s. Above that maximum it says so and the published sheets remain available. It adds "Uncertain estimate" when less than 20 % of the workbook was read or a rate that was not measured weighs more than a quarter of the prediction. Each index records its phase times and counts under importTimings. The default budget of an import, a graph construction, sheet captures or a report is 3600 s, the longest duration of an operation; linexcel serve --import-seconds N sets another default (1 to 3600), and the Long operations field of the settings still lets each user choose their own. A proposed budget goes in that field when you accept it.

A block of at least 10,000 saved values without formulas becomes a data region: one node of kind data with its bounds, header names, a type per column, a fingerprint and a bounded preview. A range node that reads a region lists it under dataRegions with the exact sub-range read, and the neighbourhood shows the link. Calculation still reads every cell of a range. The detection rule and its mixed cases are in docs/reading_resilience_data_node.md.

The application imports a structural index, then loads node pages and bounded neighborhoods as you explore. Selecting a formula cell immediately starts a fresh targeted calculation of that cell and its dependency closure, including when the graph first opens. Simultaneous visits to the same active calculation share its task. Source inputs and static VBA do not request calculation.

The source formula and saved Excel value appear independently of the calculation. Its result, coverage and dependency steps arrive asynchronously. Those steps describe engine values after the targeted evaluation; they are not a trace of executed branches or separate evaluations of each sub-expression. Unknown, unsupported and failed results remain explicit and do not stop navigation.

The graph retains its camera and existing node positions during selection and polling. Back restores a bounded navigation snapshot; Fit and Center remain explicit controls. Neighborhoods contain at most 200 nodes and can span 1–20 levels. A small cache of six neighborhoods is scoped to the workbook revision, index generation, target and depth; it does not cache away the fresh calculation. Dense overview labels still need zoom or the reader panel for individual cells.

From a selected cell, add the finding to an investigation and export the selection as offline HTML. The report freezes the source revision and available evidence at export time.

AI documentation remains a separate explicit request. Browsing and targeted calculation do not call a model. For saved worksheet data, see the embedded data browser.

Enable documentation with an explicitly selected server configuration:

linexcel serve --ai --ai-base-url https://gateway.example/v1 \
    --ai-model model-id --ai-vision-model vision-model-id \
    --ai-token-budget 100000 --ai-max-tokens 12000

--ai-token-budget bounds each documentation task. Library questions have a separate cumulative allowance, --ai-question-token-budget (default 64000), because every tool step resends the question's history.

LINEXCEL_AI_API_KEY supplies the credential. For a remote endpoint, OPENAI_API_KEY is also accepted; this generic key is withheld from loopback endpoints. The server does not load .env automatically. Set its environment before starting it, and keep credentials out of command lines.

Each text document normally uses two requests: drafting and specialized review. The per-task budget includes both. An empty, truncated or failed review fails that operation without blocking navigation; a finished operation that exceeds the server's budget is also reported as failed. Review improves the evidence checks but does not certify the prose.

The optional --ai-stream collects a streamed response before validating it. --ai-reasoning-split and --ai-thinking disabled|adaptive explicitly forward those gateway-specific request fields. Use them only when the selected endpoint supports them. --ai-max-tokens caps each response separately; none of these options changes the selected endpoint or model.

For llama.cpp templates that support it, use --ai-chat-template-thinking disabled (or enabled) to send chat_template_kwargs.enable_thinking. This is separate from --ai-thinking: a server accepting thinking.type may still ignore it. Omit the template option unless the endpoint supports it; both settings contribute to documentation cache identity. Manual acceptance exposes the same choice as --chat-template-thinking disabled.

For runtimes supporting reasoning_effort, --ai-reasoning-effort none requests direct answers explicitly; manual acceptance exposes --reasoning-effort none. The field is omitted by default, contributes to documentation cache identity, and applies to both text and vision requests. Check support on the selected runtime before setting it.

AI documentation

Opt-in, and it needs the ai extra, which uvx can add on the fly:

uvx --from "linexcel[ai]" linexcel analyze workbook.xlsx --ai-docs \
    --base-url http://localhost:11434/v1 --model <tag>

No provider is chosen for you. Name the endpoint on the command line, or set LINEXCEL_AI_BASE_URL, LINEXCEL_AI_MODEL and LINEXCEL_AI_API_KEY. See Choosing an AI provider.

Option
--ai-docs Document the workbook and its nodes.
--deterministic-only Lineage only. The default, and worth passing explicitly in a script.
--base-url, --model, --api-key The endpoint. Prefer the environment variable for the key.
--max-workers N Concurrent requests (default 4).
--max-tokens N Cap the output of each individual response.
--token-budget N Cap the whole run, in and out. See Capping the bill.
--no-workbook-doc Document the nodes, skip the workbook overview.

Describing the screenshots

Separate from --ai-docs, and deliberately so: this is the only option that puts a picture of a sheet in a request, and a picture shows every row on it.

uvx --from "linexcel[ai]" linexcel analyze workbook.xlsx \
    --screenshots shots/ --vision-docs --vision-model <a vision model>
Option
--vision-docs Describe each rendered sheet with a multimodal model. Requires --screenshots, and is refused with --deterministic-only.
--vision-model The model that looks at the images, when it differs from the one that writes.

Read Describing the screenshots before trusting the result, and Data handling for what leaves the machine.

Version

linexcel --version

A build that is not exactly a release tag reports a development version, such as 1.3.0+dev.4.g7f5caf5.