How to do a spreadjs-excel-spredjs roundtrip with metadata

Posted by: pavloboiko on 8 February 2023, 3:07 am EST

  • Posted 8 February 2023, 3:07 am EST

    When doing an excel export, is there a field that I can use inside of a spreadjs worksheet that will allow me to safely and imperceptibly for a user pass some metadata to the exported excel sheet and then get it back during the import

  • Posted 9 February 2023, 5:26 am EST

    Hi Pavlo,

    In SpreadJS, you can use tags to store private data on a sheet, cell, or cell range. However, it’s important to note that these tags are only supported in JSON/.sjs export and import of the SpreadJS workbook and not in Excel export and import. This is because the Excel format does not support these tags.

    As an alternative, you can use custom names to store string data in the sheet. Custom names are supported in both SpreadJS and Microsoft Excel. You can add custom names to a sheet using the following code:

    sheet.addCustomName('demo', 'This is a demo', 0, 0);

    Another solution is to set the visibility of a sheet to very hidden. This makes the sheet not visible to the user and it cannot be unhidden through the user interface. It can only be accessed programmatically. Here is a code snippet to demonstrate how to set the visibility of a sheet to very hidden:

    sheet.visible(GC.Spread.Sheets.SheetTabVisible.veryHidden);

    If you still face any issues, please let us know. We are here to help.

    Doc reference:

    Tags demo: https://www.grapecity.com/spreadjs/demos/features/cells/tags/tag-basic/purejs

    custom names demo: https://www.grapecity.com/spreadjs/demos/features/calculation/add-custom-name/purejs

    sheet.visible(): https://www.grapecity.com/spreadjs/api/v15/classes/GC.Spread.Sheets.Worksheet#visible

    sheet.addCustomName(): https://www.grapecity.com/spreadjs/api/v15/classes/GC.Spread.Sheets.Worksheet#addcustomname

    Regards,

    Ankit

Need extra support?

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

Learn More

Forum Channels