zemirco / json2csv

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

Doesn't properly handle leading +/- characters #213

Closed michael-ts closed 6 years ago

michael-ts commented 6 years ago
json2csv({
    data:[{a:"Hi, Joe",b:"+Joe",c:"-Joe"}],
    fields:["a","b","c"]})

=>

'"a","b","c"\n,"Hi, Joe", "+Joe","-Joe"'

When I read this into Excel it gives me "#NAME?", because it should be e.g. ="+Joe". Note that we can't treat the first column this way or Excel will treat the comma as a separator.

knownasilya commented 6 years ago

Have you tried setting the excelStrings: true property? Described here https://github.com/zemirco/json2csv#available-options

michael-ts commented 6 years ago

@knownasilya That works, thanks!