0

I am using the 'mongo-xlsx' module. But the last line doesn't work.

router.post("/xlsx",upload.single('file'), function(req, res){


var data = xlsx.parse(fs.readFileSync(__dirname + '/'+req.file.filename));
console.log(data[0].data);
var data2 = data[0].data;
var model=mongoXlsx.buildDynamicModel(data2);
console.log(model);
mongoXlsx.xlsx2MongoData("./file.xlsx", model, function(err, mongoData) {
    console.log('Mongo data:', mongoData); 
  });


});
James Westgate
  • 11,306
  • 8
  • 61
  • 68
Leehyunah
  • 1
  • 1
  • 2
    @Leeyunah, welcome to SO. _"This is not working"_ is little unhelpful. Could you please explain what happens when you run the program? Does it give an error? If so, what is the error? – Duck Dodgers Jan 08 '19 at 08:49
  • Possible duplicate of [Reading Excel file using node.js](https://stackoverflow.com/questions/28860728/reading-excel-file-using-node-js) – Gamote Jan 08 '19 at 09:28
  • @JoeyMallone, error is "Mongo data : undefined" I want to know what "./file.xlsx", I don't know if it means something. – Leehyunah Jan 09 '19 at 00:57

0 Answers0