missing commas when saving excel as CSV

  • Thread starter Thread starter Andy Fish
  • Start date Start date
A

Andy Fish

Hi,

I have a very strange symptom that occurs when saving a CSV file from excel.

Say the first row has 2 columns and the next 20 rows have only a value
entered into the first column but not the second. When I save this file as
CSV, the first row obviously has a comma between the two values, and the
next 15 correctly have a comma after the value (to indicate that the second
column is empty). However, the 16th and subsequent rows have no comma.

since I'm trying to parse the file with PHP this is a right royal PITA.
anyone know why it's happening or if there is a workaround? (BTW I'm using
Excel 2000 but I beleive it happens with later versions)

Andy
 
I think that this comes close to describing your problem:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q77295
XL: Column Delimiters Missing in Spreadsheet Saved as Text

Maybe you could put a single apostrophe (which tells xl that the cell isn't
empty) in those blank cells.

And more example code for writing to a text file:

Chip Pearson's:
http://www.cpearson.com/excel/imptext.htm

Earl Kiosterud's:
http://www.tushar-mehta.com/
Look for Text Write in the left hand frame.

J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html
 
Thanks, good to know it wasn't me going mad then

Thanks for the workaround suggestions. Fortunately it's easy for me to work
around the problem in the PHP

Andy
 
Back
Top