Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


nicholas maddren
nicholas maddren
12,793 Points

CSV to Database Example?

Hello community, I need to add a function to my site that imports a CSV file into a mysql database. When the CSV file is updated I want ruby to update the database like a cron job. I am unfamiliar with Ruby and someone has told me Ruby will best fit this function. The CSV contains car information here is an example:


I am unsure how it will read the CSV because the first column is the header that explains the values of each row.

Any advice on this would be great. I am going to display the vehicle information in an ecommerce inventory list on the front end of my site.

Could someone show me a bit of example code that would work for my needs?