Link to home
Start Free TrialLog in
Avatar of amateur_player
amateur_player

asked on

csv file to excel file-show leading zeros

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
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amateur_player
amateur_player

ASKER

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