Along the same lines as Carlos, I think Excel uses the character ' to indicate left-aligned text.......as in it won't display it but will tell Excel you are giving it a string and not numbers.
Main Topics
Browse All TopicsI am creating an Excel spreadsheet from and ASP.Net web page query. One of my fields is for a social security number, datatype varchar. The problem is that when Excel reads in the data it defaults the social security number field to numeric which causes leading zeros to be truncated. I need a way to preformat the Excel column to text to preserve the data.
I have tried to pass the data to Excel via xml and an xsl stylesheet but can't seem to get the stylesheet to work correctly.
Does anyone have any experience with this or know of another way to preformat Excel?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sorry for the delay in returning a response. I tried your suggestion but it didn't seem to work. Could be that although I was appending the space to the front of the social security number ASP.Net was truncating it during transfer to excel, I don't know. However, you did give me another idea. I simply inserted the normal dashes into the social security number. That's an accepted format and doesn't interfere with sorting in excel.
Business Accounts
Answer for Membership
by: CarlosMuPosted on 2002-11-22 at 06:21:20ID: 7483488
The solution doesnt have to do with XML, or ASP, but with EXCEL. Try entering the number with a space prefixed. If you put a space to the left of a number in Excel the program will treate it as text.