Formualizer Docs
Recalc CLI

Recalc CLI

Recalculate the cached formula values in an .xlsx after openpyxl or another tool edits it, from Python, npm, Cargo or a prebuilt binary.

formualizer recalc fills in the formula results that other tools leave empty or stale. openpyxl and most workbook libraries write formulas but never calculate them, and saving drops the cached values that readers such as openpyxl with data_only=True, pandas and file previewers rely on. Run formualizer recalc after the last save and those readers see current values.

  • Keep your editor. It recalculates in place without rebuilding the workbook: formula text, styles, drawings, names and untouched package parts stay byte-for-byte.
  • Strict, not best-effort. Workbooks outside the supported subset are refused as a whole (exit 2) instead of published with guessed values.
  • Made for scripts and agents. --json prints one machine-readable object; exit codes separate success, refusal, stale checks and errors. See the agent workflow.

Install

uvx formualizer recalc book.xlsx            # run without installing
pip install formualizer                     # then: formualizer recalc book.xlsx
python -m formualizer recalc book.xlsx      # same CLI through the module

Native wheels for Linux (glibc and musl), macOS and Windows on Python 3.10+. The CLI is not available in Pyodide; there, formualizer.recalculate_xlsx_bytes performs the same recalculation on in-memory bytes.

30-second example

Write a workbook with openpyxl, recalculate it, then read the values:

from openpyxl import Workbook, load_workbook

wb = Workbook()
ws = wb.active
ws.append([10]); ws.append([20]); ws.append([30])
ws["B1"] = "=SUM(A1:A3)"
ws["C1"] = "=SEQUENCE(3)"
wb.save("book.xlsx")
print(load_workbook("book.xlsx", data_only=True).active["B1"].value)  # None: no cache yet
$ formualizer recalc book.xlsx
book.xlsx: recalculated 2 formulas, 4 cached values changed, 0 error cells (written)
ws = load_workbook("book.xlsx", data_only=True).active
print(ws["B1"].value, [ws[f"C{r}"].value for r in (1, 2, 3)])  # 60 [1, 2, 3]

SEQUENCE(3) became a dynamic-array spill over C1:C3. Running the command again reports unchanged and leaves the file untouched; formualizer recalc book.xlsx --check exits 3 when caches are stale and never writes.

Next

On this page