Skip to content

Instantly share code, notes, and snippets.

@spyderman4g63
Created November 28, 2012 21:13
Show Gist options
  • Save spyderman4g63/4164550 to your computer and use it in GitHub Desktop.
Save spyderman4g63/4164550 to your computer and use it in GitHub Desktop.
ruby csv parse
require 'csv'
csv_text = File.read('test.csv')
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
puts "Name: #{row['name']} - Age: #{row['age']} -  Sex: #{row['sex']}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment