How do I get excel to not mess around with the formatting of a .csv file

12

3

I have two issues with a csv file that occur when I try and edit it in Excel.

  1. I have an ISBN column that gets reformatted to scientific format every time I save the file
  2. The encoding for the file is changed from UTF-8 to ANSI when I open the file.

It is really, really frustrating and a complete waste of time.

Is there any way that I can force Excel to leave the format of the file alone?

Martin Duys

Posted 2011-07-01T13:21:41.880

Reputation: 1 171

Relevant: http://www.eusprig.org/stories.htm (My favorite horror story is #39)

– pavium – 2011-07-01T14:28:28.170

2Again, PLEASE PLEASE don't use Excel for CSVs!!!! – surfasb – 2011-07-03T05:52:59.460

Answers

10

Don't double click on the CSV file because that will auto format the columns. Instead create a new spreadsheet and use the Data Import and you can manually format the columns to TEXT to avoid cutting off numbers and silly auto formatting.

kobaltz

Posted 2011-07-01T13:21:41.880

Reputation: 14 361

5

It's sad that on the Windows side, Excel has somehow become the defacto editor of CSV files, even though it does a sub par job at it. I had the same experience as you as I was merging two speadsheets of contacts and importing them into Google.

The problem you are having is since CSV files contain no formatting metadata, Excel loads the text file with all default formats. If it detects date on the load, guess what? If it detects leading zeros, guess what??

I gave up with Excel. And you should too!

Access is a far better tool. For one, Access, by defaults, imports all data into as text. It doesn't do any gimmick formatting unless you tell it to. Two, it actually formats CSVs correctly by allowing you to surround all fields with quotation marks. It all leave untouched leading spaces. Spread the word.

Saves lives!! Spread the word!! Don't use Excel for CSVs!!! Use Access!!

surfasb

Posted 2011-07-01T13:21:41.880

Reputation: 21 453

I like that :-) Nice and passionate. Let me try it immediately! – Martin Duys – 2011-07-02T08:14:32.527

Aargh! My Office licence doesn't include Access. Any ideas around other applications that I could use? – Martin Duys – 2011-07-02T08:18:31.867

I'm going to try the options mentioned in this post

– Martin Duys – 2011-07-02T08:26:36.913

Yeah, anything but Excel to use CSVs. That sucks you don't have Access. 1000 times better at handling CSVs than Excel. – surfasb – 2011-07-02T19:16:33.833

This is nice. Importing and exporting UTF-8 with Excel 2013 on Windows 7 always caused me problems. Access seems great 1) Once linked to a csv i dont have to configure import settings every time i load the file. 2) I can easily sort columns without the need to turn csv into an excel table and likely much more! – bioslime – 2014-05-25T10:52:09.243

2

  1. Open the .csv file with a notepad program.
  2. Save the file as a .txt file
  3. Open Excel (do not right click the file and select the 'Open with' option)
  4. Using Excel, open the .txt file (you'll need to tell excel to display all file types)
  5. Make sure that when you reach step 3 of the text import wizard, you manually assign any columns that you don't want altered to text formatting
  6. Click "Finish"

Alton

Posted 2011-07-01T13:21:41.880

Reputation: 21

0

I just give up excel and create my own tool. It is still in development but you can try it, it generally works with the data I have. I have tried CSVed, but it seems that it cannot handle cell value with line breaks.

user1022209

Posted 2011-07-01T13:21:41.880

Reputation: 203