I am importing a csv file with the following code. I need to be able to
load the file into a hash or an array so that I can access the values in
each column and row individually. There aore 14 columns in each row and
the number of rows varies from file to file. I have no idea how to do
this as I am a complete noob to the cvs libray and could only find
limited documentation. Any help would be greatly appreciated. TIA
@transactions = []
FasterCSV.foreach("#{RAILS_ROOT}/public/MyExport.csv") do |row|
@transactions << row
end
I am importing a csv file with the following code. I need to be able to
load the file into a hash or an array so that I can access the values in
each column and row individually. There aore 14 columns in each row and
the number of rows varies from file to file. I have no idea how to do
this as I am a complete noob to the cvs libray and could only find
limited documentation. Any help would be greatly appreciated. TIA
@transactions = []
FasterCSV.foreach("#{RAILS_ROOT}/public/MyExport.csv") do |row|
@transactions << row
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.