zemirco / json2csv

Convert json to csv with column titles
http://zemirco.github.io/json2csv
MIT License
2.72k stars 364 forks source link

excelStrings option works incorrectly with quoted values #511

Closed mikhalev-im closed 3 years ago

mikhalev-im commented 3 years ago

Version of json2csv: 5.0.5 Node version: 12.19.1

Code:

const { Parser } = require('json2csv');

const parser = new Parser({
  header: false,
  delimiter: ';',
  excelStrings: true,
});

const data = {
  field1: 'string',
  field2: '"quoted"'
};

parser.parse(data);  // result: "=""string""";"=""""quote"""""

If you write the result to a file and open it in excel, there would be an error in a quoted value:

Снимок экрана от 2021-01-27 10-33-07

The tooltip is saying that the formula has an error.

mikhalev-im commented 3 years ago

Guys, thank you for your work! Do you know when this fix will be released on npm?

knownasilya commented 3 years ago

Should be released as json2csv@5.0.6