• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 690
  • Last Modified:

How to preserve commas in CSV file when saving the file in Excel 2010

Hi experts
I've problem in preserving the commas in a CSV file when I try to save the file by Excel 2010.
The csv files are attached. Thanks in advance.

Before saving:
Settings,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Description,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1, 2, 3, 4,5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,,,,,,,,,,,,,,,,,,,,

After saving by Excel 2010:
Settings,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Description,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33
original.csv
saved2010.csv
0
dominicwong
Asked:
dominicwong
  • 3
  • 2
2 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
It looks to me like it is saving on the area where there is content.  If you want it to save all of those blank columns, you need some content in the last column to the right.
0
 
dominicwongAuthor Commented:
Thanks Dave.
The empty columns are for future expansion so they are blank for the moment.

Or, is there any characters that I can insert and they don't get displayed in Excel 2010?
0
 
Dave BaldwinFixer of ProblemsCommented:
Just a space... ' '.  I think the idea of leaving it completely blank for expansion just doesn't work in a spreadsheet.  If you don't have placeholders of some kind, it just gets ignored.  Most Excel files intended for databases have column names in the top row which define the width of the sheet and the number of entries in the CSV rows.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Dushan De SilvaTechnology ArchitectCommented:
Your program can read end of line charter to read(\r\n) [i.e. 0x0a 0x0d] it as a new line, instead of waiting for all the commas.
0
 
dominicwongAuthor Commented:
Thanks Dave and Dushan.
A better option is to rewrite my code and avoid the dependency on the empty columns.
0
 
Dave BaldwinFixer of ProblemsCommented:
I agree.  Thanks for the points.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now