While I'm appending data to csv in a loop headers also getting appended in csv file, for example consider below query
10.times do
CSV.open("file_name", "ab", write_headers: true, headers: ["team", "points"]) do |csv|
csv << ["SRH","20"]
end
end
Resulting CSV will have alternate headers and alternate values. How to prevent appending headers multiple times? Thanks in advance.