Custom formulas as values on export as xlsx in spreadjs designer

Posted by: anton.kagakin on 16 May 2025, 4:41 am EST

    • Post Options:
    • Link

    Posted 16 May 2025, 4:41 am EST

    I have some custom formulas implemented for SpreadJS in my application.

    When I’m exporting as xlsx with “Include formulas” option my formulas exported as formulas too.

    But Excel knows nothing about my custom formulas, so I have a question, can I export my formulas as values and standard as formulas?

  • Posted 20 May 2025, 4:58 am EST - Updated 20 May 2025, 5:03 am EST

    Hi,

    Apologies for the delay caused over the weekend.

    You’re correct—when exporting with the “Include formulas” option enabled, SpreadJS will export all formulas, including custom ones. However, since Excel doesn’t recognize custom functions, they show up as errors like #NAME? error.

    To generate an XLSX file export containing the standard formulas and results of custom formulas without the actual formulas, it is required to pre-process the SpreadJS Workbook to strip off the custom formulas. Please refer to the attached sample that implements a custom logic to achieve the same (see below).

    Please feel free to reach out if you encounter any further issues or require additional guidance.

    Sample: customValues.zip

    Steps to run the sample:

    • Open the folder in the terminal and write the command - npm i to install project dependencies.
    • Run the command - npm run start to start the application.

    Gif:

    Regards,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels