Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

csv file to excel file-show leading zeros

Posted on 2004-08-31
2
Medium Priority
?
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 300 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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 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