require 'csv' table = CSV.parse(csv_data,encoding: "bom|utf-8",headers: true) table.each do |rec| puts rec["header_name"] end