write to csv ruby with headers code example Example: ruby create CSV CSV.open("file.csv", "a+") do |csv| csv << ["cow", "3","2500"] end