Closed moonweazel closed 8 years ago
I did it like
var data = [];
/* Generate automatic model for processing (A static model should be used) */
var model = mongoXlsx.buildDynamicModel(data);
mongoXlsx.xlsx2MongoData("./category.xlsx", model, function(err, mongoData) {
console.log('Mongo data:', mongoData);
});
Hi!
If the model is defined null
, then the library builds the model with the excel first row column names.
I will update the readme!
var model = null;
var xlsx = './file.xlsx';
mongoxlsx.xlsx2MongoData(xlsx, model, function(err, data) {
console.log(data);
});
Morning!
I can't seem to get mongo-xlsx to autogenerate the model. My spreadsheet has a lot of columns that might change so I don't really want to manually create the model myself.
without declaring mongoModel - I get "mongoModel is undefined". If i declare it as null then I get "Cannot read property 'split' of undefined from line 356 (mongo-xlsx.js).
Any pointers?
Cheers!