search
Twitter Rss Feeds
MicrosoftArticlesForumsGroups
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml/Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

Web ProgrammingArticlesForumsGroups
JavaScript
ASP
ASP.NET
Web Services

Non-MicrosoftArticlesForumsGroups
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

DatabasesArticlesForumsGroups
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsGroups
Microsoft Excel
Microsoft Word
Microsoft Powerpoint
Publisher
Money

Operating SystemsArticlesForumsGroups
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsGroups
Share Point
BizTalk
Site Server
Exhange Server
IIS
Transaction Server

Graphic DesignArticlesForumsGroups
Macromedia Flash
Adobe PhotoShop
Microsoft Expression

OtherArticlesForumsGroups
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Reviews
Search Engines
Resumes

 

Previous Thread

8/15/2006 7:28:02 AM    CSV dropping last comma for all lines after line 15
Hi there, I hope someone has seen this before and knows the fix! We have a 
 
csv file format that we use to upload data to our custom system. The last 3 
 
columns in the file are optional so they can sometimes be blank. We have 
 
noticed that Excel is dropping the last comma on the lines beyond data line 
 
15. So for example, I have a file with a header row and 20 rows of data. Say 
 
all these data rows have the last 3 columns blank. If I save the file in CSV 
 
and upload it, the system fails the upload since the lines 16 and beyond have 
 
a missing comma! So I open the file in notepad to see what's up and I notice 
 
that data lines 1 - 15 end with 3 commas ,,, since the columns were blank. 
 
But the data lines 16-20 only had 2 commas! The last comma dropped!! 
 
It is consistently happening with every file I have that has more than 15 
 
lines! 
 
Thanks for your help. 
 
KZ

8/15/2006 11:58:34 AM    Re: CSV dropping last comma for all lines after line 15
Maybe you could just put a formula that evaluates to "" in the last column of 
 
the rows that are empty. 
 
="" 
 
Select the range in the last column 
 
edit|goto|special|blanks 
 
(ok) 
 
type 
 
="" 
 
and hit ctrl-enter 
 
Then try saving the file as a CSV file. 
 
KZ wrote: 
 
-- 
 
Dave Peterson

8/15/2006 1:13:50 PM    Re: CSV dropping last comma for all lines after line 15
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.) 
 
KZ wrote: 
 
-- 
 
Dave Peterson


Pete's Blog   |    Pete's Resume   |    Robbe's Blog   |    Robbe's Resume   |    Archive #2   |    Archive #3   |    Dotnetslackers   |    XmlPitStop   |    Advertise   |   Contact Us   |   Privacy   |   Copyright (c) 2000 - 2009 eggheadcafe.com  All rights reserved.