Importing CSV in Ruby

Readme Homework


Episode 4: Ruby off Rails

Learn Ruby First. Rails Optional

We're going build a program that downloads a CSV file and creates a graph using Google Charts.

At the end of today's lesson, we'll have learned the basic CSV syntax, how to test a CSV importer, and some basic looping techniques… but don't worry about all that, let's build!

The Answers

You can see a working version and can view the answer branch.

Requirements

Just Ruby
We'll use Ruby 1.9.3 MRI for this

Learn More

To join our Quarterly classes on learning Ruby, check out http://rubyoffrails.com

Copyright License - MIT

Copyright 2012 Ruby off Rails.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Importing CSV in Ruby

  • Area:

    Databases  
  • Runtime:

    44  
  • Tech:

    CSV, google-charts  
  • Tags:

    csv web  

How to import records from a CSV file --- something you'll probably do about a billionty times. There aren't any assignments for this episode though --- so take the week to regroup, catch up, and get fired up for the next block of episodes!

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

ABOUT RUBY OFF RAILS

Ruby Off Rails is dedicated to accelerating the mastering of Ruby and increasing developer happiness everywhere.

In my software training, I see two distinct sets of programmers: those who know Ruby, and those who haven’t learned it yet. People who learn Ruby have an easier time understanding Rails, gems, and what magic voodoo is going on. And most importantly, they can cast wicked voodoo themselves.