Re: Opening then saving a CSV file looses Commas in Excel 2003

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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 three 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

(or maybe you could build your own formula and copy|paste into Notepad.)

In G1:
=a1
In G2:
=a2&","&b2&","&c2&","&d2&","&e2&","&f2
then drag down.

You may need to insert additional quotes or formatting:

=a2&","&text(b2,"mm/dd/yyyy")&....




Sean Wolfe wrote:
>
> If i have a CSV file that has a number a fields, some at the end which
> may not be filled in for some rows, after a few lines, Excel will omit
> the trailing commas for the empty fields. This causes some problems when
> trying to import the editied file into other applications.
>
> This is repeatable for me on many machines.
>
> also take a look at this issue,
> http://groups-beta.google.com/group/microsoft.public.excel.misc/browse_frm/thread/b12633abc92c3c73/9f624ccd84bb48a6?q=excel+csv+line+17+drops+commas&rnum=1&hl=en#9f624ccd84bb48a6
>
> I've included a sample CSV file that exibits this particular behavior.
> Take the attached file, and open it in Notepad. Notice the trailing
> commas. Now open the file in Excel, then Just click the save button. It
> will wanr you about some compatibilty issues and answering either Yes or
> no makes no difference. Answering no just makes you do an additional
> step of saving a separate workbook. Now open the same file again in
> Notepad. Noice after around line 17, the trailing commas dissapear and
> then reappear somewhere around line 81.
>
> I've been able to reproduce this on 3 different machines now, so I know
> it's not just my system that is exibiting this behavior.
>
> I tried searching the knowledge base extensively for this but was unable
> to find any answer.
>
> Sean
>
> --------------------------------------------------------------------------------
> Name: Sean'sList_22.csv
> Sean'sList_22.csv Type: Microsoft Excel Worksheet (application/vnd.ms-excel)
> Encoding: base64

--

Dave Peterson
.



Relevant Pages

  • Re: CSV dropping last comma for all lines after line 15
    ... Column Delimiters Missing in Spreadsheet Saved as Text ... Then try saving the file as a CSV file. ... noticed that Excel is dropping the last comma on the lines beyond data line ...
    (microsoft.public.excel.setup)
  • Re: Saving file in CSV format
    ... This might describe the problem of too many commas in CSV files: ... Column Delimiters Missing in Spreadsheet Saved as Text ... I am facing a problem while saving a CSV file from Excel. ...
    (microsoft.public.excel.misc)
  • Re: How do I allow blank columns in a .CSV file?
    ... empty. ... But if you actually do need those extra commas, ... Column Delimiters Missing in Spreadsheet Saved as Text ... I have a faily basic excel worksheet that I am saving as a csv file. ...
    (microsoft.public.excel.misc)
  • Re: Save As CSV problem
    ... The Text Write program does not normally write field delimiters (normally ... commas) past the last field that contains something, ... From what I've heard, Excel's CSV file type sometimes does, and ... > Column Delimiters Missing in Spreadsheet Saved as Text ...
    (microsoft.public.excel.misc)
  • Re: When converting an .xls file to .csv I get too many commas at the.
    ... This might describe the problem of too many commas in CSV files: ... Column Delimiters Missing in Spreadsheet Saved as Text ...
    (microsoft.public.excel.misc)