Ronio
Ronio

Reputation: 89

Meteor: xlsx to json parsing

Im working on a project using Meteor in which i need to do some data parsing from given xlsx file into json. Actually i want some thing like that i upload a xlsx file it gives me data back in the form of json.

Since, Meteor is a nodejs framework so i tried every nodejs npm packages like xlsx,node-xlsx,excel,excel-parser etc etc but Meteor doesn't support the packages' files and gives errors.

So, anybody there who has any hack for this or any solution for parsing xlsx file into json without any issues using Meteor.

Upvotes: 2

Views: 1681

Answers (2)

Mickael Lecoq
Mickael Lecoq

Reputation: 241

You have made a small application which reads an excel file in Meteor.

You can find it here meteor-import-excel-example

Upvotes: 1

Hubert OG
Hubert OG

Reputation: 19544

You need to load the package correctly. If you just install the package in project directory like in a plain Node.js project, Meteor will pick it up as source code and try to compile it in its way, which will lead to errors.

The correct way is to use npm package.

1) Install it with mrt:

mrt add npm

2) Create packages.json with list of Node packages you want to use:

{
  "xlsx": "0.6.1"
}

3) Load the package with Meteor.require:

var xlsx = Meteor.require('xlsx');

Upvotes: 1

Related Questions