wolfsuite

Headless formula calculation

Write fresh formula values before Excel opens

openpyxl preserves formula text but does not calculate formulas. WolfXL can evaluate a documented formula set in the Python process, save supported cached values, and report boundaries that need qualification.

Recalculate one workbook on the server

from wolfxl import CalculationOptions, load_workbook

workbook = load_workbook("model.xlsx", modify=True)
workbook["Inputs"]["B2"] = 120_000

report = workbook.calculator.calculate(
    CalculationOptions(now_serial=45_000.75, random_seed=73)
)
assert report.values["Summary!B12"] == 42_000

workbook.save("recalculated.xlsx")
workbook.close()

The saved workbook contains the formula text and the fresh cached result for supported formulas. A later input or formula edit invalidates stale cached values until calculation runs again.

Use this when fresh values are part of the output contract

  • A worker must produce current totals before a user downloads the workbook.
  • A downstream parser reads cached values without opening Microsoft Excel.
  • A CI job verifies formulas and expected outputs before publishing a report.
  • A service needs deterministic calculation inputs such as time and random seeds.

Qualify the exact formula set

Formula support is intentionally bounded. Test the actual workbook, dependency chains, named ranges, external references, iterative settings, and dynamic-array behavior before production use. Unsupported formulas or external values must be resolved explicitly rather than treated as a universal Excel result.

Prove your formula workflow before production

A 30-day evaluation can test one named nonproduction workflow. The Production Workbook Pilot adds written success criteria, output evidence, deployment notes, and a rollback plan.