Reputation: 107
So I having problems with my csv-parser that is reading values where it adds a column on empty cells from a csv file. It gives an error of
column header mismatch expected: 17 columns got: 18
For now I have to go in the csv file and backspace a comma to match the columns. I know is a parse csv issue, has anyone encounter this? below is my csv code.
function readStream () {
let stream = fs.createReadStream("accounts.csv");
fast
.fromStream(stream, {
headers: true
})
.on("data" , fetchYelp, fetchWhitePages, fetchGooglePlace, writeStream
)
.on("end", function () {
console.log("Done Reading");
});
}
readStream();
Upvotes: 0
Views: 1109
Reputation: 30715
Could you try using the discardUnmappedColumns option, e.g. ? That works for me!
function readStream () {
let stream = fs.createReadStream("accounts.csv");
fast
.fromStream(stream, {
headers: true,
discardUnmappedColumns: true
})
.on("data" , fetchYelp, fetchWhitePages, fetchGooglePlace, writeStream ) {
})
.on("end", function () {
console.log("Done Reading");
});
}
readStream();
Upvotes: 1