Posted 22 January 2026, 11:58 pm EST
- Updated 23 January 2026, 12:03 am EST
Hi Dung,
In SpreadJS, formula calculation is synchronous by default. However, if your workbook includes asynchronous or delayed formulas (for example, server-backed formulas or incremental calculation), some cells may still be pending at the time values are retrieved or exported.
There is no single global flag that guarantees all formulas are finished in every scenario, especially when async logic is involved. The recommended approach depends on the type of formulas used:
For purely synchronous formulas:
Ensure calculation is triggered before export, for example, by calling spread.calculate() after all data updates and before exporting.
For asynchronous or delayed formulas:
Export should be synchronized with the actual completion of the calculation. A reliable pattern is to:
- Track when async formula evaluations start and finish (e.g., using a counter in custom async functions)
- Observe calculation progress from the workbook
- Proceed with export only when there are no pending calculation cells and all tracked async executions are complete
Please refer to the minimal working sample below, which demonstrates this pattern with an async formula and a calculation-complete guard before export.
Additionally, we are implementing an event that will be triggered when all calculations are completed in SpreadJS; however, this feature is currently in our product backlog, and no ETA is available.
Please let us know if you encounter any further issues or require additional assistance.
Kind Regards,
Chirag
Attachment: https://jscodemine.mescius.io/share/DTIwwuJcQUWLPgDURCr5kw
Working:
