tags:

views:

149

answers:

1

I am generating a csv download from my web server and to be safe, I have enclosed each field with double quotes.

i.e.

"Field1","Field2","Field3","Field4"
"row1_field1","row1_field2","row1_field3","row1_field4"
"row2_field1","row2_field2","row2_field3","row2_field4"

The problem is that when the file is opened in Excel, it does not strip all quotes... Therefore, some fields are appearing as: row1_field1 whereas others are appearing as "row1_field2"

What am I not doing to ensure that excel strips all surrounding quotes?

+4  A: 

Make sure there are no spaces around the commas. So the following should work:

"row1_field1","row1_field2","row1_field3","row1_field4"
"row2_field1","row2_field2","row2_field3","row2_field4"

But this will show up with the quotes in place:

"row1_field1", "row1_field2", "row1_field3", "row1_field4"
"row2_field1", "row2_field2", "row2_field3", "row2_field4"
Dean Harding
Thanks - that's the ticket
sjw