Solved

csv file to excel file-show leading zeros

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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