Datatables, how to export to excel with number format (instead of general)

Viewed 29

I'm attempting to export to excel with number format (instead of general).

When exporting a datatable to excel, the columns with numbers in them have the below issue: enter image description here

I have tried using the customize option to no avail:

customize: function( xlsx ) {
   var sheet = xlsx.xl.worksheets['sheet1.xml'];
   $('row c[r^="F"]', sheet).attr('s', 63);
}

Also, I have tried return the data as a number:

exportOptions: {
  format: {
     body: function ( data, row, column, node ) {
        switch (column) {
           case 5:
              return Number(data);
              break;
           default:
              return data;
              break;
         }
      }
    }    
 }    

Any advice would be greatly appreciated!

0 Answers
Related