Is it possible to change the headers of a "csv" file to uppercase during the process performed by papa.parse using JavaScript?!
Thanks in advance.
Is it possible to change the headers of a "csv" file to uppercase during the process performed by papa.parse using JavaScript?!
Thanks in advance.
beforeFirstChunk: function(chunk) {
var rows = chunk.split( /\r\n|\r|\n/ );
var headings = rows[0].toUpperCase();
rows[0] = headings;
return rows.join("\r\n");
},
supporting 'beforeFirstChunk' solved me this issue, nevertheless if you use 'worker: true' inside your configuration it will trigger an exception, looks like a known bug.
As of version 5.0, PapaParse now has transformHeader
, which is
A function to apply on each header. Requires header to be true. The function receives the header as its first argument. Only available starting with version 5.0.
You can see an example at Using PapaParse transformHeader to remove whitespace from headers?.
© 2022 - 2024 — McMap. All rights reserved.