« Simplified Dynamic Drill-Through to Microsoft CRM Using Logical Entity Name | Main | CRM with Outlook 2010/UR11 + Workaround for Missing ISV Menu items »
June 10, 2010
TrackBack
TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54fb34b6f88330133f08db91c970b
Listed below are links to weblogs that reference CRM Data Imports, CSV, and Leading Zeros:
Comments
Verify your Comment
Previewing your Comment
This is only a preview. Your comment has not yet been posted.
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.




The problem with Excel is on opening CSV files, not saving them. It makes assumptions when you open CSV files, and treats data that looks like numbers as numbers, dropping leading zeroes as it goes along. Another related problem is if you have fields with long numbers in them (such as serial numbers or product codes) which may get truncated as Excel only supports 15 significant digits (strictly "truncated" is the wrong word because they are padded to the right length/order of magnitude, but you lose the detail at the end, which is the point).
To get round this, you need to force Excel to let YOU choose what data type is in which column. The easiest way I have found to do this is change the file extension to .txt, open the file with a file>open and you get the data import wizard. Explicitly declare any possible problem fields as TEXT (or just do this for all fields if that works for you).
Another option I have seen discussed is to add a dummy row of data to your CSV where every field has a text entry such as "DELETEME" - Excel won't treat your columns as numeric if even a single entry is text. This is more annoying (for me anyway) because you need to edit it in and out in a text editor.
Posted by: AdamV | June 14, 2010 at 06:47 AM
True, Adam. The zeros get stripped out when Excel opens the file. My point was that the problem doesn't become permanent unless you save the file. If you just open a csv to view in Excel and don't save, the zeros will still be in the csv.
Good suggestion on saving as text.
Posted by: Joel Lindstrom | June 14, 2010 at 05:04 PM