I'm opening a csv file in excel and every time I open it, it changes some fields into dates when they are clearly not dates (they're CAS numbers, not that its important). How do I stop this behavior? I know I can change the column format but this doesn't help when I first open the CSV file.
-
This question could be moved to superuser ... – Kent Pawar Nov 22 '13 at 10:16
-
You can enforce text value by `="2010-5-5"`, see https://stackoverflow.com/questions/165042 – xmedeko Sep 27 '17 at 08:16
3 Answers
Unfortunately, there's not much you can do while the file has .csv
extension. Excel has special handling for .csv files. There is a way to deal with it, but it involves renaming the files to have some other extension. You can rename .csv
file to have extension .txt
, for example, then open the .txt
file with Excel: this time Excel will ask you to confirm details of the files for import. At the first step, select delimited; at the second step, select comma as the delimiter and double quote for the quote element. Finally, at the next step, you will have the option to specify the column formatting. Just select all columns and select text, for example. Alternatively, select the one column in question and choose number (although this risks getting scientific notation (1.23456E+10) if the numbers are long.

- 56,435
- 29
- 168
- 265
-
-
-
Just how unbelievably stupid this is. Shouldn't the default be number, not date when in Excel? – reima Mar 28 '17 at 07:45
If the files stay in csv format than they cannot retains any formatting choices that you make. So you have two choices:
- Unformat the columns and save the file to .xls
- Use the Text Import Wizard each time you wish at access this data. This tool give you the option to specify how the data will be interpreted by Excel.

- 1,187
- 6
- 11
Try putting an apostrophe before every cell.
It will just make text cells, and will not appear as data in cells.

- 32,008
- 25
- 109
- 114

- 9
-
1I think you're missing the point. The OP needs to get correct formatting _before_ he/she can do anything with it. – Aleks G Oct 09 '12 at 18:33