Rectangle 27 0

Ruby csv file related operations?


FasterCSV.foreach(path_to_file, { :headers => true, :row_sep => :auto }) do |row|

Assuming you have CSV in following format

Each time you iterate the csv you would get row from your CSV file, now you already know that column 2 has "network_id" header and column 3 has "network name" header so you can easily give network_id = row[2], network_name = row[3]

You can user FasterCSV; If you have headers in your csv then you can specify it headers => true what you can do is to fetch data from row by row using FasterCSV,as given below

Zipcode Network ID Network Name Zone New Network? Display Name 64024 275 Kansas City 2 No Kansas City 64034 275 Kansas City 2 No Kansas City

Note