I am using DataTables to generate a csv report but I am having an issue with formatting some values when opened with excel. The one column contains long numbers such as 014848124888245 that when generated in the csv export are formatted like so: 1.4848124888245E+13. I would like to format these values as a string so that if the csv file is opened with excel the value is displayed in the original format.
I know that this can be solved by just opening the csv file with a text editor, but for this specific use case I need to use the csv export button and open the file using excel.
This is how I instantiate my datatable and the csv export:
var table = $('#unpaidinvoicetable').DataTable( {
dom: 'Bfrtip',
buttons: [
{
extend: 'csvHtml5',
exportOptions: {
columns: ':visible',
charSet: "utf-8",
}
}
]
} );
I tried messing around with the exportOptions a bit using datatables' csvHtml5 documentation, but I cannot figure out a way to achieve the formatting I want (not have excel format the value to E notation)