Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Node.js Basics 2017 Building a Command Line Application Parsing JSON

KarthikReddy Lingareddy
KarthikReddy Lingareddy
403 Points

How to parse a CSV file?

I have data set which is in CSV format, how can I decode that?

2 Answers

Steven Parker
Steven Parker
231,261 Points

CSV stands for "comma-separated values", so unless some of the fields contain commas, you can easily convert a line of data into an array with "dataString.split(',');".

Fields that contain commas in the data will be enclosed in some way, often with quote marks. Decoding that would be a bit more involved but hopefully you won't have that issue.