Custom Export with Custom values using Handsontable

Tags: #<Tag:0x00007efc64771bd8> #<Tag:0x00007efc647710c0>

Hi Team,

I am looking for a custom export option in which for some fields i have to do custom calculations like divide by 100 while exporting alone and it should not reflect in the grid. Kindly let me know if any options available in the handsontable.

Regards,
Vijay V

Hi @vijayvelchamy.v

I’m not sure if I understand your requirements right. Do you mean exporting the table to a certain file type? If so, currently we support only export to CSV, and you can find all the available configuration options here: https://handsontable.com/docs/javascript-data-grid/export-to-csv/

Hi @adrian.szymanski,

I want to export the table to CSV in angular. but before exporting i need to perform some logics on the cells. As per below image we could see values in the table but while clicking on export i need to perform some logic on E5 cell (highlighted in below image) like E5/100 and display the value (E5/100) on the CSV file. This logics should not affect the actual grid data it should only reflect on CSV file.

Thanks,
Vijay V

image

@vijayvelchamy.v

Thank you for the confirmation. In such case we unfortunately don’t have any API that would let you do this easily.

It seems that the only option here would be to use setDataAtCell method https://handsontable.com/docs/javascript-data-grid/api/core/#setdataatcell to alter the values you need, export the file and then again using setDataAtCell reset the values to their initial state.

The whole logic could be done as a batch operation for the best performance and results. You can read more about it here: https://handsontable.com/docs/javascript-data-grid/batch-operations/

The cons of this solution is that if you allow users to do undo/redo operations, then the changes needed for export purposes would be in their changes stack.

Hi @adrian.szymanski,

Thanks for your support. You can close the topic.

@vijayvelchamy.v

Thank you for the update.