Data format after csv export

Tags: #<Tag:0x00007fce6a35bf48> #<Tag:0x00007fce6a35bdb8>

Hello, Grid data exporting works good, but there is one problem.

  1. For some reason cell value “3/4” in my exported excel file tranformed to date format as 4 March.

Here is exporting options that we use:
exportPlugin.downloadFile(‘csv’, {
columnDelimiter: ‘,’,
columnHeaders: true,
filename: ‘PO_Detail-CSV-file_[YYYY]-[MM]-[DD]’,

In my columns array, Catalog # is set to be text type.

How can I fix that? Thank you

Hi @rcarney

It is more about how Excel interprets the / sign - it seems that this article explains this phenomenon and gives some hints on how to solve the issue.

1 Like

Thank you. The issue has been resolved. We have decided to generate an Excel file on the backend, utilizing data and column headers from a grid. Subsequently, we will transmit this Excel file back to the client’s browser. Here’s an example that might be useful for someone. Just use any library that lets create and convert excel file to blob.

 const grid_headers = hotInstance.getColHeader();
    const grid_data = hotInstance.getData();

    const data = {
        'type': 'PO_Detail',
        'grid_data': grid_data,
        'grid_headers': grid_headers
    }; url + '/api/v1/excel/export', data,
                'Authorization': 'Bearer ' + token,
                'Content-Type': 'application/json'
            responseType: 'arraybuffer',
    ).then((response) => {
        const url_l = window.URL.createObjectURL(new Blob([]));
        const link = document.createElement('a');
        link.href = url_l;
        link.setAttribute('download', type + Math.random() + '_.xlsx');
    }).catch((error) => console.log(error));

I am glad to hear the progress. Using server-side generation sounds like a good idea. Thank you for sharing the code.