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

Posted on 2012-08-15
Last Modified: 2012-08-16
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:
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:
Question by:dominicwong
    LVL 82

    Expert Comment

    by:Dave Baldwin
    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.

    Author Comment

    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?
    LVL 82

    Assisted Solution

    by:Dave Baldwin
    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.
    LVL 17

    Accepted Solution

    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.

    Author Closing Comment

    Thanks Dave and Dushan.
    A better option is to rewrite my code and avoid the dependency on the empty columns.
    LVL 82

    Expert Comment

    by:Dave Baldwin
    I agree.  Thanks for the points.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This article will show you how to use shortcut menus in the Access run-time environment.
    Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
    This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now