Lots of programs won't care if there are extra trailing commas at the end. For
instance, excel won't care.
But if you do...
Saved from a previous post:
This might describe the problem of too many commas in CSV files:
http://support.microsoft.com/default.aspx?scid=77295
Column Delimiters Missing in Spreadsheet Saved as Text
(It actually describes missing delimiter, but if some are "missing", maybe the
ones appearing are "extra".)
(But a lot of programs (excel included) don't care about those extra columns. Maybe you don't have to care, either???)
Maybe you could write your own exporting program that would behave exactly the
way you want:
Here are some sites that you could steal some code from:
Earl Kiosterud's Text Write program:
www.smokeylake.com/excel
(or directly: http://www.smokeylake.com/excel/text_write_program.htm)
Chip Pearson's:
http://www.cpearson.com/excel/imptext.htm
J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html
JKnipe wrote:
I was running Windows XP 32 bit and Microsoft Office 2007 Professional, and when I saved my spreadsheet to CSV format, it never added additional commas in the blank cells. I just upgraded to Windows 7 64 bit and installed a new license for Microsoft Office
2007 Enterprise, and now when I save the same file to CSV format, it adds commas for all the blank cells out to the last cell of the row with the most data. Can someone tell me what is different or what I can do to make it ignore blank cells like it did before?
For example if my spreadsheet was like:
Matt | Mary | John | Tom | James
5 | 7 | 6 | 4 | 8
Yes | Yes | | |
my CSV file will look like:
Matt,Mary,John,Tom,James
5,7,6,4,8
Yes,Yes,,,
I dont want the three commas after the second "yes" to be there. The files I am actually dealing with have thousands of lines of data and find/replace in text editor is too risky to mess up the data and possibly program our machinery wrong.
--
Dave Peterson