Delimiter “;” doesnt work

孤者浪人 提交于 2019-12-12 04:08:23

问题


I using the following code to achieve the result below

function handleFileSelect(evt) {
   var file = evt.target.files[0];

   var asd = Papa.parse(file, {
       delimeter: ";",
       newline: "",
       quoteChar: '"',
       header: true,
       complete: processResults
   });
}

My .csv file looks like this:

2000;51013;;Kronospan Szczecinek Sp.z o.o.;ul. Waryńskiego 1 78-400 SZCZECINEK;PL6731657551;PLN;PL;;PL;D;51013

In the returned file it is written as:

2000,51013,,Kronospan Szczecinek Sp.z o.o.,ul. Waryńskiego 1 78-400 SZCZECINEK,PL6731657551 Zweryfikowany poprawnie,PLN,PL,,PL,D,51013

Note that the ; became ,.

anyone can help me?


回答1:


for autodetect delimiter 
delimiter: "",

1.
var asd = Papa.parse(file, {
       delimeter: "",//automatic detect delimiter 
       newline: "",
       quoteChar: '"',
       header: true,
       complete: processResults
   });

2. you can remove delimiter from config

var asd = Papa.parse(file, {
       newline: "",
       quoteChar: '"',
       header: true,
       complete: processResults
   });


来源:https://stackoverflow.com/questions/46641864/delimiter-doesnt-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!