Solved

csv file to excel file-show leading zeros

Posted on 2004-08-31
2
315 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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