I am trying to read a CSV file with fast-csv in Node.js. The csv file has a header row which contains 90 columns. 87 of them have unique names. But 3 columns have the same header name "Transformation". This is obviously a semantic mistake. Fast-csv is complaining that headers are not unique and does not read the CSV. I know, all column names should be different, but this is how I get the CSV file. Is there a way to read the headers and if some column has a name that another column has, the name automatically converts to "Transformation_int", with int being some random number?
csv.parseFile(csvFileName,
{ headers: true, delimiter: ";",
headers: headers => headers.map(
h => {h.replace( /[\r\n]+/gm, " " )})
})
.on ("data", function (row) { <doing something> })
.on ("error", error => {console.log("This error occured:",error)})
.on ("end", () => { console.log("Import finished")});