Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.



Add comment:
Name:
Email:
Comment: *
(Use BBcode - No HTML)


You MUST answer this simple math equation - to prevent spammers: 9 + 16 =  


How can I keep leading zeros when building a CSV file?

Last updated: 07/03/2009
Some data looks like a number on the surface, but really is not meant to be used that way. Zip codes are one such data type.

When creating a CSV file, a zip code like 01039 will come up in Excel as 1039, which is not what you want. 

An easy fix is to enclode the zip code as follows, when generating your CSV:

..."PA",="01039","blah"...

the = sign seems to tell Excel to keep the literal, and not try cleaning it up.




Powered by KnowledgebasePublisher 1.1
Superb Internet
Content provided by Roberts WebForge, Inc.