I know how it is done row-wise
CSV.foreach(filename.csv) do |row|
puts \"#{row}\"
end
But I am completely lost column wise?
Bored so decided to cook up an alternate solution here. Only works (here) if the first row has the max number of columns
columns = {}
rows.first.each_with_index do |col, i|
columns[i] = []
end
rows.each do |row|
row.each_with_index do |cell, i|
columns[i] = columns[i] + [cell]
end
end
Now you should be able to access each column by its index