Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have csv file which contains data 0001,0002,0003

When I open this file in excel, starting nulls are removed

Its possible to save starting nulls at opening file in excel ?

share|improve this question

migrated from Apr 22 '13 at 23:07

This question came from our site for professional and enthusiast programmers.

Are you asking about nulls as in " " (a space) or as in leading zeros? – James Jenkins Apr 22 '13 at 15:52
up vote 3 down vote accepted

To do this, open Excel first.

Click on Data > Import from text.

You will get a window where you'll have to pick the import type. Choose Delimited then next.

In the next screen, check only comma, then next.

On this screen, click the first column in the preview box, scroll to the last column. Hold SHIFT and click the last column. This should make all the columns 'black' (you actually selected all the columns).

Now, click the radio button Text. After that, click Finish and OK to get your data as you wanted it to be!

share|improve this answer

If you are able to control the generation of your CSV file, you can force Excel to interpret the input as text by saving it as follows:


(Be careful that you use typewriter quotes, as above, rather than curly [smart] quotes.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .