Missing starting zeros when exporting CSV file.

Missing starting zeros when exporting CSV file.

marcobatongbacalmarcobatongbacal Posts: 1Questions: 1Answers: 0
edited July 2018 in Free community support

This is my button to export CSV file,

buttons: [
           'print',
           'excelHtml5',
           {
            extend: 'csv',
        text: 'CSV',
        customize: function(data, config, api){
              console.log(data)
            }   
        }
           ]

and this is my return data

"COL","CORTEZ","JAIME","SAGADRACA","Updated","000008605","00620","2018-07-13 11:47:28","administrator","Update pensioner status"

The starting zeros on data 000008605 is missing when exporting it to CSV. What should i do? Thanks in adavance!

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @marcobatongbacal ,

    I just tried it here, and it's working as expected. If you open the CSV file, it displays the 0s as expected. I suspect the problem is that if you open the file in Excel, it'll strip it out 'helpfully', so you'll need to format the column accordingly - this can't be done in a CSV file, since it only contains the data, there is no formatting information,

    Cheers,

    Colin

This discussion has been closed.