Community discussion forum

save .csv with newline character

  • 1 year ago
    i'm creating a .csv file on the fly, thus am enclosing all the data within double quotes. how to put in a newline character is the problem. for eg:- i tried the following - "header1","header2","header3"\n"data1","data2","data3"\n"data11","data22","data33" and "header1","header2","header3 \n"\r\n "data1","data2","data3 \n"\r\n "data11","data22","data33" so that the output looks like header1 header2 header3 data1 data2 data3 data11 data22 data33 thanks a lot for your help
    Post was edited on 19/11/2008 10:58:59 Report abuse
  • 1 year ago
    Which bit of your data needs to actually contain the newline? According to this post: [http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm#EmbedBRs](http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm#EmbedBRs) you can actually leave the new lines inline, so something like this, is valid: Conference room 1, "John, Please bring the M. Mathers file for review -J.L. ",10/18/2002,... as the line breaks are within the double quotes. Hope that helps!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!