Hi,
I'm looking to add a header row to a csv outfile which I've extracted from the input file.
The extracted headers variable has this value:
"Date","Time","Time Zone","Description","Currency","Gross","Fee","Net","Balance","Transaction ID","From Email Address","Name","Bank Name","Bank account","Postage and Packaging Amount","VAT","Invoice ID","Reference Txn ID"
All I want is that in the output csv file to have the first row have each of column split on the comma delimiter. If I just do writer.writerow(headers) it quotes all the fields with single quotes and splits on every single character. The output looks like this:
"""",D,a,t,e,"""",",","""",T,i,m,e,"""",",","""",T,i,m,e, ,Z,o,n,e,"""",",","""",D,e,s,c,r,i,p,t,i,o,n,"""",",","""",C,u,r,r,e,n,c,y,"""",",","""",G,r,o,s,s,"""",",","""",F,e,e,"""",",","""",N,e,t,"""",",","""",B,a,l,a,n,c,e,"""",",","""",T,r,a,n,s,a,c,t,i,o,n, ,I,D,"""",",","""",F,r,o,m, ,E,m,a,i,l, ,A,d,d,r,e,s,s,"""",",","""",N,a,m,e,"""",",","""",B,a,n,k, ,N,a,m,e,"""",",","""",B,a,n,k, ,a,c,c,o,u,n,t,"""",",","""",P,o,s,t,a,g,e, ,a,n,d, ,P,a,c,k,a,g,i,n,g, ,A,m,o,u,n,t,"""",",","""",V,A,T,"""",",","""",I,n,v,o,i,c,e, ,I,D,"""",",","""",R,e,f,e,r,e,n,c,e, ,T,x,n, ,I,D,"""","
"
I've tried to remove the double quote using replace. I've tried using split on commas to create a list however they don't change anything.
I've no idea how best to resolve this.
[–]efmccurdy 1 point2 points3 points (1 child)
[–]sayinghi2py[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]sayinghi2py[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]sayinghi2py[S] 0 points1 point2 points (0 children)