From: James Edward Gray II Date: 2011-02-16T22:55:22+09:00 Subject: Re: How to read CSV in Ruby 1.9.2 On Feb 16, 2011, at 1:43 AM, Chris Kottom wrote: > Simple example... > > require "csv" # require the CSV library > CSV.foreach("path/to/file.csv") do |row| # open your file and loop through > the rows > p row # print each row's contents > p row.count # count the number of values in > each row (CSV::Row is Enumerable) > ... > end Taking that one step further, an import using Rails 3 usually goes something like this: require "csv" CSV.new( params[:file].tempfile, :headers => true, :header_converters => :symbol ).each do |row| MyModel.create!(row.to_hash) end Hope that helps. James Edward Gray II