For example:
UserID,UserName,UserAge
00123,TestUser01,21
01221,User02,23
When you import such a text file into Excel, it will convert the UserID into NUMERIC value instead of a TEXT value. Thus resulting in the truncation of the leading zero.
This is also true when you are trying to import a DATE value. Excel will automatically convert it into a date, but if your text file does not use the standard MM/DD/YYYY format, it will screw up.
To prevent Excel from automatically converting these data, you will need to tell Excel to maintain them as TEXT field. To do this, put the text value into a ="" qualifier. This is what you do in the .csv file:
UserID,UserName,UserAge
="00123",TestUser01,21
="01221",User02,23
When you import it, the 00123 will remain as 00123. Or if it is a custom date field, it will remain as text value.
Hope this helps someone out there. You can always contact me at joseph.lee (at) f s.com.my (it is done this way purposely from preventing spam email crawler).
No comments:
Post a Comment