Solved

csv file to excel file-show leading zeros

Posted on 2004-08-31
2
319 Views
Last Modified: 2012-06-27
I ran a query from an app in vb.net and put the results in a csv file. The query is a "dynamic query" and depends on what fields the user chooses. When i open the file the leading zeros are being removed.iS THERE ANYWAY FROM THE PROGRAM I CAN FORCE TO DISPLAY leading zeros. I tried the following suggestion in one of the websites:

"change the file extension to .txt Excel will now provide a dialog during the import that allows you to specify delimited or fixed format, allows you to specify the delimiter (you'll most likely want comma) and the format to apply to each column prior to the import (you'll probably want 'Text' for the cells with the leading zero's).".
The above suggestion has worked. is there any way of creating a macro or changing the format so that the file can be picked and automatically updated with leading zeros
thanks
0
Comment
Question by:amateur_player
2 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 100 total points
ID: 11952090
put quotes around the numbers with leading 0s ... otherwise excel will treat them as numbers and remove the 0s.
0
 

Author Comment

by:amateur_player
ID: 12079676
Infact i did not check the answer after putting the question. I did the same thing few minutes after posting the question. Not only for the leading zeros let's say a number is more than 10 digit length in csv file then the number will be displayed in scientific notation in excel. So you have to put quotes if you dont want to do all the steps in formatting. Thanks for the answer
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…

856 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