Append a single line to a csv file for a multiple of times using Julia

try this (it seems that the keyword header is not the correct one)

I assumed you only want to write the header once.

using DataFrames
using CSV

df = DataFrame(A=1:3, B=4:6, C=7:9)

fi="c:\\temp\\append_a_line.csv"
fi="append_a_line.csv"


for i in 1:10   # do the following for 10 times    
    CSV.write(fi, df, writeheader = (i==1), append = true)
end
1 Like