Delimiter “;” doesnt work

2019-08-23 00:33发布

问题:

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
   });



标签: papaparse