Handsontable Export Functionality

Tags: #<Tag:0x00007efc6b4d85f0>

Hi,

I am using below code to add a row in the exported data but the data is not changing in exported file and also in the table
exportHandler = () => {
const {
data: { name },
} = this.props;
const { hotInstance } = this.hotTableComponent.current;
const newRow = [‘a’, ‘b’, ‘c’];
hotInstance.loadData([ newRow, …hotInstance.getData()]);
const exportPlugin = hotInstance.getPlugin(‘exportFile’);
exportPlugin.downloadFile(‘csv’, {
filename: ${name}-${moment().format('YYYYMMDD_HH:MM:SS')},
columnHeaders: true,
});
}

Maybe you could try this https://jsfiddle.net/2c17bz5n/ ?

Hi Aleksandra,

Thankyou for your valuable response, Here we are having row number 2 missing but I want to add a row before column Heading.

Also how can I export data with default background color?

the .csv format does not support cell metadata and formatting.

I want to add a row before column Heading.

Header is always on the topic. You’d need to use nestedHeaders functionality or add a second table on the top, however, none of them will be visible in the exported .csv file.