Meteor & CSV data


#1

Hello, I am just wondering how Meteor handles CSV data?

So for example I have a CSV file that is delivered to my server daily and I’d like to import this data into MongoDB.

Is there an easy way of importing data into MongoDB with Meteor? Or will I have to find another way with PHP or something to do this?

Thanks, Nick


#2
  1. Go to https://www.npmjs.com/ and find a CSV parser package
  2. Use the npm package to convert the CSV data to an array of objects
  3. Iterate through the array and insert the objects into MongoDB

If it is unclear how to do step 2 and 3, just search for them. You will likely find an answer.


#3

You can find meteor packes handling this stuff for you like a charm :slight_smile:
Install them inside console with “meteor add” inside the root folder of the application
https://atmospherejs.com/?q=csv


#4

I’ve had to deal with CSV import/export and I used https://atmospherejs.com/harrison/babyparse


#5

Ryan Glover wrote a recipe about importing CSVs, I think you can find an answer there: https://themeteorchef.com/snippets/importing-csvs/