The code is working fine it takes list of maps convert them into csv and export the value. This is the code
def to_csv(map, path) do
file = File.open!(path, [:write, :utf8])
map
|> IO.inspect()
|> CSV.encode(headers: true)
|> Enum.each(&IO.write(file, &1))
end
This is the list of maps
%{
name: "Kelsie",
date_of_birth: ~D[1944-06-02],
end_date: ~D[2017-10-30],
category_id: [14, 9, 19, 14],
room_name: "Filomena",
id: 11,
},
%{
name: "Karson",
date_of_birth: ~D[1944-06-02],
end_date: ~D[2017-11-04],
category_id: [15, 19, 7, 14, 9],
room_name: "Bert",
id: 12,
}
]
File is exporting successfully but the list of category ids not inserting . I just got \t\n
in the place of category id.
Any suggestions?
If its possible?
Thanks