-
-
Save maurcs/108198 to your computer and use it in GitHub Desktop.
Uses ruby's built in CSV Reader which will find " escaped columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
file = "db/commission_junction/2087028_18584_20080827.csv" | |
rows = CSV::Reader.parse(File.open(file)).to_a | |
cols = rows.shift | |
collection = rows.collect do |row| | |
Hash[*cols.zip(row).flatten] | |
end | |
puts collection.first.inspect | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment