I have a .txt file and when I save it as a csv the leading 0s are no longer there
I have a .txt file which needs to be .csv file.
So for example .txt File 00
When I open .csv file 0
Even after I format the csv file it still opens up with no leading 0
CSVfile is a text file saved with commas separating unformated values, created with a basic set of rules.
Some of the basic rules for
Rules typical of these and other
CSVspecifications and implementations are as follows:
CSVis a delimited data format that has fields/columns separated by the comma character and records/rows terminated by newlines.
CSVfile does not require a specific character encoding, byte order, or line terminator format (some software does not support all line-end variations).
- All records should have the same number of fields, in the same order.
Data within fields is interpreted as a sequence of characters, not as a sequence of bits or bytes.
Adjacent fields must be separated by a single comma. However,
CSVformats vary greatly in this choice of separator character. In particular, in locales where the comma is used as a decimal separator, semicolon, Tab, or other characters are used instead.
Any field can be quoted (that is, enclosed within double-quote characters). Some fields must be quoted, as specified in following rules.
Fields with embedded commas or double-quote characters must be quoted.
1997,Ford,E350,"Super, luxurious truck"
Each of the embedded double-quote characters must be represented by a pair of double-quote characters.
1997,Ford,E350,"Super, ""luxurious"" truck"
The first record may be a "header", which contains column names in each of the fields (there is no reliable way to tell whether a file does this or not; however, it is uncommon to use characters other than letters, digits, and underscores in such column names).
Year,Make,Model 1997,Ford,E350 2000,Mercury,Cougar
(More from the source: Wikipedia.)
This method will also allow you to import a .txt file without changing the file type to .csv
When you open a csv into excel it will workout what type of format the data should be and convert it for you, for example two zeros 00 will be reformatted as a number and automatically changed to a 0
To import a csv into excel and keep the data formatted in its original way you will need to use the Text import wizard:
Open excel, in the ribbon click on Data, select From Text, then browse for the csv file.
Make sure Delimited is selected and click Next, select the delimiter that is used within your csv, click on Next
For each column that contains the two zeros 00, select them and then change the Column Data Format to Text, when all column formats have been changed click Finish
In all columns where the formatting has been changed to text, you will have have to change the cell formatting manually for any data that should not be treated as text.