Microsoft Excel Leading Zeros on CSV import.
I've seen this question posed on various forums and for the most part, the answer is always something beyond a direct answer to the simple question of "how can I have Excel open a csv file and keep the leading zeros in a column intact?". Most of answers give a solution that calls for some level of manual manipulation beyond what is the intent of the question.
In my case, I wanted to create a comma delimited file on a mainframe and have the mainframe send out the file as an email attachement via SMTP. I wanted the said attachment to be a csv attachment that could be clicked on by the recipient to automatically launch Excel with the contents of the attachment. I didn't want the user to have to save a text file and import, or run some kind of macro, or mess around with text to columns, etc. I just wanted the user to be able to click on the file to launch the csv file in Excel, while keeping the leading zeros. Period.
What worked for me was formating the data as ="0098765".
In my case, I wanted to create a comma delimited file on a mainframe and have the mainframe send out the file as an email attachement via SMTP. I wanted the said attachment to be a csv attachment that could be clicked on by the recipient to automatically launch Excel with the contents of the attachment. I didn't want the user to have to save a text file and import, or run some kind of macro, or mess around with text to columns, etc. I just wanted the user to be able to click on the file to launch the csv file in Excel, while keeping the leading zeros. Period.
What worked for me was formating the data as ="0098765".