3

There is a CSV file, which I try to read and it contains field with value

"Aprobil P 0.1%"

the short example of CSV:

"Country";"Product Family"
"Germany";"Aprobil P 0.1%"

conversion to workbook is the following:

var workbook = XLSX.read(csvData, {
                    type:'string',
                    dateNF: 'D-M-YYYY',
                    cellDates:true,
                    cellText:true,
                    cellNF: false,
                raw:false});

after conversion I save the XLS, where value "Aprobil P 0.1%" is converted to a date 01.04.00

Looking into the worksheet model and getting the certain cell, it contains:

{
      t: 'd',
      v: 'Sat Apr 01 2000 00:00:00 GMT+0300 (Eastern European Summer Time)',
      z:undefined
}

The best way I see at the moment is to set the raw to true and process the values in my own way. Or 2) replace all occurrences of Aprobil to something similar, but looks like I need to to the same trick for all the 12 months...

Is there any other way to cover this case?

Paul Z.
  • 133
  • 6

1 Answers1

0

Try this:

read options : {cellText:false,cellDates:true}

In your conversion function:

var data = XLSX.utils.sheet_to_json(ws, {header:1, raw:false, dateNF:'D-M-YYYY'});
Charles G
  • 767
  • 6
  • 8