Giter Club home page Giter Club logo

mongo-xlsx's People

Contributors

acedward avatar anhvietcx avatar edwardmbx avatar guillevalin avatar nicarq avatar schsj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongo-xlsx's Issues

README Quick Example Error

There is very small error in quick example in *README.md
*

/* Read Excel */
mongoxlsx.xlsx2MongoData("./file.xlsx", model, function(err, mongoData) {
console.log('Mongo data:', mongoData);
});

"mongoxlsx should be mongoXlsx"

Error for some .xlsx files

Although it works for some xlsx files, for other ones I get this error:

/Volumes/Data/Projects security/nxte/big-data/database/node_modules/mongo-xlsx/lib/mongo-xlsx.js:398
  mongoModel.forEach(function(f) {
             ^

TypeError: mongoModel.forEach is not a function
    at convertMongoModelToObject (/Volumes/Data/Projects security/nxte/big-data/database/node_modules/mongo-xlsx/lib/mongo-xlsx.js:398:14)
    at Object.exports.xlsxData2MongoData (/Volumes/Data/Projects security/nxte/big-data/database/node_modules/mongo-xlsx/lib/mongo-xlsx.js:328:24)
    at /Volumes/Data/Projects security/nxte/big-data/database/node_modules/mongo-xlsx/lib/mongo-xlsx.js:305:29
    at /Volumes/Data/Projects security/nxte/big-data/database/node_modules/mongo-xlsx/lib/xlsx-rw.js:69:12
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

Adding styles

Can someone give a snippet on how to add styles ?

Model not being autogenerated from my excel spreadsheet

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.

var mongoXlsx = require('mongo-xlsx');

var mongoModel;

mongoXlsx.xlsx2MongoData("avivadotcom.xlsx",mongoModel, function (err, mongoData) {
    console.log('Mongo data:', mongoData);
});

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!

can not assign save flag to false

I try to assign save flag to false but unsuccess, I have investigated and found that below code make stuck
if (!options.save) {options.save = makeDefault('save');}
option.save always set to true.

Please take time to fix this bug.
Thanks

Convert array of objects in different excel sheet in one excel

Using below code, not able to convert the data into one excel with mutiple sheets. I am getting all data in one sheet.

var  jsonXlsx = [[{ "Name": "Eddie", "Email": "edward@mail" }], [{ "Name": "Nico", "Email": "nicolas@mail" }]] ;
const sheets = ['a','b'];
var excelPageData = [];
/* Generate automatic model for processing (A static model should be used) */
var model = mongoXlsx.buildDynamicModel(jsonXlsx);

/* Generate Excel */
  excelPageData.push(mongoXlsx.mongoData2XlsxData(jsonXlsx, model));
  mongoXlsx.mongoData2XlsxMultiPage(excelPageData, sheets, function(err, data) {
	console.log(err)
  console.log('File saved at:', data.fullPath); 
  });

Can we transpose headings

I implemented the excel sheet
Now iam trying to interchange rows to columns (Headings on the left like picture below)

excel

not working with model mapping file

The program works fine if model name passed as null. however, when I run it using mapping model it always lead to below error. Please help!

TypeError: mongoModel.forEach is not a function
at convertMongoModelToObject (D:\react\react-redux\metrics-node-services\node_modules\mongo-xlsx\lib\mongo-xlsx.js:398:14)
at Object.exports.xlsxData2MongoData (D:\react\react-redux\metrics-node-services\node_modules\mongo-xlsx\lib\mongo-xlsx.js:328:24)
at D:\react\react-redux\metrics-node-services\node_modules\mongo-xlsx\lib\mongo-xlsx.js:294:26
at D:\react\react-redux\metrics-node-services\node_modules\mongo-xlsx\lib\xlsx-rw.js:69:12
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:446:3)
model-config.txt
sample-output-withNull.txt

Roadmap

  • Parsing dates from an excel in returning invalida dates (internal excel model)
    temporal workaround:
var ms = ((numericExcelDate - (25567 - 1)) * 86400 * 1000);
var ms_offset = (new Date().getTimezoneOffset() * 60000);
var dt = new Date(ms + ms_offset);
  • Use underlying XLSX module directly. Will allow finer control over transformations.
  • Allow compressing arrays
    e.g.,
    now: { anArray : [ 1, 'a', 3 ] , aString : 'hey' }
    is converted to:
anArray[0] anArray[1] anArray[2] aString[0]
1 a 3 hey

it could be, optionally, converted to:

anArray[0] aString[0]
1, a, 3 hey

Allowing external systems/scripts to easily access information based on column position

  • Add Convert From XLSX tests
  • Convert to CSV

Import not comming properly

My exported data is not comming in order,its coming a single character in a column

data.collection("Points”).find({'businessId': ‘shopname’ ,’_created_at':{$gt:d}}, { _id: false}).toArray(function(err, result) {

for(f=0;f<result.length;f++)
{
data = '{'+" Shop : ""+result[f].businessname+"", Points : "+result[f].point+'}';
data = data+" , " +data;
}

//data export
data = [data];
data = data.replace(/'/g, '');
var model = mongoXlsx.buildDynamicModel(data);
mongoXlsx.mongoData2Xlsx(data, model, function(err, data) {
console.log('File saved at:', data.fullPath);
});

This is what i am doing
but i guess my data comes as
['{shop : "shopname",Points : 10 }'];
Please help .i tried replace function but its not working .
Or is it any other issue,

exporting multiple sheets in one excel

iam trying this to generate multiple sheets in one excel,but iam getting output as object

const sheets = ['a','b'];
mongoData2XlsxMultiPage(monogData, sheets, options, callback)

Parsing date error

When i am adding timestamps (createdAt and updatedAt) for converting mongo to xl data , I am getting this error "Cannot read property 'SSF' of undefined". That error is coming only when I am adding timestamps. Can someone please help me out ?

timestamps in mongo db :
"updatedAt" : ISODate("2016-11-24T05:50:28.240Z")
"createdAt" : ISODate("2016-11-22T16:23:46.127Z")

Not converting Date if date is passed in between 01- 09

I am converting excel data to get data in json form. An issue I am facing is that whenever I am passing the date in between 01-09 , the date is converted into some number.

examplex.xlsx
This is the excel data

For the last two row data is correct.But in the 1st row the bike purchasing date is some random number.

Its not converting the date properly.

This is the data which it is converting

data [ { Name: 'Suresh',
    Address: 'mumbai',
    'Purchase date': 42800,
    'Bike Dealership Name': 'sales',
    'Bike Make': 'hero',
    'Bike Model': 'splender' },
  { Name: 'Yash',
    Address: 'bhopal',
    'Purchase date': '15-05-2017',
    'Bike Dealership Name': 'gv',
    'Bike Make': 'HONDA',
    'Bike Model': 'aviator' },
  { Name: 'Saif',
    Address: 'Bhopal',
    'Purchase date': '31-05-2017',
    'Bike Dealership Name': 'vaibhav',
    'Bike Make': 'Honda',
    'Bike Model': 'Dio' } ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.