Prevent reformatting of data in CSV import in Excel

Posted on 2012-09-04
Last Modified: 2012-09-04
How to force excel to treat columns as text automatically. I have a .csv file as below


The third column always has the leading 0 stripped. I know I can change it to a .txt file name and use the import wizard dialogue to manually treat the column as text. But I really prefer it to be automatic and not force the user to constantly manually set column types. Is there a way to force the column to automatically be text? I thought I had read something about apostrophe at the start of the column but that doesn't seem to work, the apostrophe stays in the column in Excel.
Question by:gringlobal
    LVL 10

    Accepted Solution

    If you have control on the export format of the CSV, use the equal sign in front of the values you don't want intepreted:

    e.g., ="PI",500000,="01",="SD"
    LVL 25

    Expert Comment

    Do you have the ability to control the content of the .csv file?  If so, can you try making the third column a formula?

    i.e.:   ="001"  The = needs to outside the quotes.
    LVL 25

    Expert Comment

    oops - I started my reply and got interrupted.  Mark gave the proper response.   :)

    Author Closing Comment

    I have control of the format and the = seems to work. You see ="01" when you select the cell but it looks OK in the cell and filter seems to work. Thanks.
    LVL 10

    Expert Comment

    Glad to be of help...

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Sometimes we don't want to show zeros in our Excel spreadsheets. This is sometimes most evident in our charts. Look at the chart below, all the zero values are visible. I think that all will agree with the fact that zero values are not looking nice …
    Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
    Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
    This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

    728 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

    17 Experts available now in Live!

    Get 1:1 Help Now