Right now I am trying with the library fast-csv doing this:
var stream = fs.createReadStream(\"./google.csv\");
csv
.fromStream(stream, {he
You can use node module 'csv-parse'.
Take a look at the following code.
var csvParser = require('csv-parse');
fs.readFile(filePath, {
encoding: 'utf-8'
}, function(err, csvData) {
if (err) {
console.log(err);
}
csvParser(csvData, {
delimiter: ','
}, function(err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
}
});
});
Here filePath is path of the csv file and the delimiter will be as per your file. It is the character that separates fields in csv file(can be ',', '.', etc).