Excel strips "s from CSV and inserts 0D0As ...

J

Joe HM

Hello -

I use Excel to open a *.csv file that looks as follows in an ASCII
Editor ...
"A-XXX-123","A"
"A-XXX-1234","A
M"
"A-XXX-12","U
A
M"

Note that every entry is enclosed in double quotes and the line-breaks
are just 0A (10). When I save the file from Excel, it creates this ...
A-XXX-123,A
A-XXX-1234,"A
M"
A-XXX-12,"U
A
M"

Excel deleted all the "s where there is no line-break and also inserted
0D0A (13 10) line-breaks.

This behavior causes some problems for another program that is reading
in the *.csv after the editing.

Is there a way to make Excel save the file as it was and just change
cell text?

Thanks!
Joe
 
H

Harlan Grove

Joe HM wrote...
....
Is there a way to make Excel save the file as it was and just change
cell text?

No, not when saving CSV files.

Excel only puts double quotes around fields that contain commas or
newlines (field and record separators, respectively), and while Excel
will read text files with only linefeeds (hexadecimal char code 0A) as
newlines, it only uses Windows standard carridege return-linefeed
newlines when writing text files other than Mac text files, and Mac
text files use carridge return (hexadecimal char code 0D) only as
newlines.

If you new Unix newlines (linefeed only) and double quotes around all
fields, you need to use something other than Excel or use VBA and
binary file output in order to replace the double quotes and use only
linefeeds as newlines.
 
J

Joe HM

Great ... I will give that a try ... too bad Excel cannot do all that
....

Thanks!
Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top