Headless formula engine and serialization
The formula engine can be used without rendering a grid, for example in Node.js or on a server for validation and pre-computation. Workbook state (values, formulas and names) can be serialized to JSON and restored, so formulas can be persisted to a backend and reproduced exactly.
Planned. This page shows the specification from issue #192. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid alongside a JSON panel that shows the serialized state, plus a 'headless run' console that evaluates a snippet in a worker without any DOM.
Expected behavior
Serializing and then restoring reproduces identical values. The headless run returns the same results as the grid. Invalid JSON is rejected with a schema error.
Planned API surface
function: createFormulaEngine(options)method: formulaEngine.setSheetContent(data)method: formulaEngine.serialize()function: FormulaEngine.deserialize(json)method: formulaEngine.getCellValue(address)Acceptance criteria
- The engine package has no DOM dependency (verified by running it in Node). (pending)
- The serialize and deserialize round trip is lossless, including named expressions and sheets. (pending)
- The serialized schema is versioned and documented. (pending)
- Custom functions must be re-registered before deserialize, and missing ones yield #NAME?. (pending)