16

I am using Excel that comes with Office 365. And this version of Excel does something annoying that's breaking all my macros.

I want to import a CSV file into a sheet WITHOUT any table formatting and such. This was the default behaviour in older versions of excel. But now that the table formatting is there, it's destroying all the macros that I have programmed.

The end result I want is shown in this picture: enter image description here

But that's not what I'm getting. Here's what I did.

I first went to Get Data>From File>From Text/CSV as shown in this picture: enter image description here

I select the file I want then I see a pop up window and I press the Load button as shown in this picture: enter image description here

But the result I get is this green formatted table as shown in the picture: enter image description here

This green formatted table is breaking my macros. I want to import the csv as a plain spreadsheet with no formatting, no drop down header functionality etc...I want just a normal basic spreadsheet. How do I get Excel to do this?

2
  • 2
    I'm curious how your macros are being destroyed by a different formatting, perhaps if you include that in your question a more helpful answer can be given? Commented Aug 3, 2020 at 12:55
  • @GlenYates I'm sure that will break the rest of the macros.
    – Mast
    Commented Aug 4, 2020 at 8:54

5 Answers 5

21

You can certainly go back to the previous method of importing.

  • GoTo: File-->Options-->Data:

enter image description here

  • Select the Text legacy import wizard.

Then, when you want to do the import

  • Data-->Get&Transform-->Get Data
  • You will see the Legacy Wizard in the drop down

enter image description here

7
  • 1
    Thank you! The new importer is so irritating when you don't want that behaviour!!
    – yoyo
    Commented Feb 17, 2022 at 4:02
  • The 'Data' option is missing in Excel as of 2022.
    – Mark Ebden
    Commented Jun 24, 2022 at 13:26
  • @MarkEbden I wasn't aware there was an Excel 2022. Is that the actual version? (That Data option is certainly present in my Excel 365) Commented Jun 24, 2022 at 16:16
  • @RonRosenfeld sorry I have MS Office Professional Plus 2016. Googling this issue it seems a lot of people are just resigned that this aspect of Excel is unfixable. The software cannot properly import CSV files with dates, and it is what it is.
    – Mark Ebden
    Commented Jun 28, 2022 at 19:17
  • @MarkEbden That option is not present in 2016. If you want it, you'll need to update. The other option is to use Power Query (available in Excel 2010+) and set the date column appropriately. It works just fine to import csv files, and is more flexible than the legacy wizard. A more complicated alternative would be to write a VBA macro. Commented Jun 28, 2022 at 19:51
9

I'm not sure if this fits your workflow, but instead of importing you can open the .csv file in Excel:

  • File ➡ Open (or press CTRL+O).
  • Make sure All Files or Text Files is selected in the file type dropdown. enter image description here
  • Select the .csv file and press Open.

Now your .csv file should be opened as a regular range (without table formatting).

5
  • This is simplest and best imo. Just open the file instead of using Get & Transform Data. Another option is just paste the data into the spreadsheet. Commented Aug 3, 2020 at 13:28
  • 2
    I would add that this might not work as intended in different locales. For example, on my machine, the locale setting for list separator is ;, not ,, so if I try to open a proper CSV directly in Excel, it won't open it correctly (and if I save a CSV from Excel it will not use commas, also)
    – bracco23
    Commented Aug 4, 2020 at 8:30
  • @bracco23 is it locale, or the delimiter set in Data -> Text to Columns? For me it seems that Excel remembers which delimiter I set last time, and uses that onwards, until I set a different delimiter in the Text to Columns dialog. Commented Aug 4, 2020 at 9:41
  • @SaaruLindestøkke using open file as shown in this answer, it uses directly the one defined in the locale. Using Data -> Text to Columns works fine as I can freely select the appropriate separator (but then if i save the file as CSV it uses the locale separator)
    – bracco23
    Commented Aug 4, 2020 at 9:46
  • 3
    I would never recommend double click a csv file to open it, or using File > Open. The built in Excel csv parser will not interpret line breaks within quoted data and it will auto-convert text to numbers (removing leading zeros). The method used by the person asking the question is the safest way to ensure data integrity.
    – SeanOB
    Commented Jul 2, 2021 at 2:20
5

This is a partial answer as I am not sure if you can avoid the formatting when importing the data. But after importing it, it is possible to remove the formatting.

  1. Select the entire table with Ctrl+A
  2. On the Table Design tab, click on Convert to Range
  3. Then on the Home tab, click on Clear -> Clear Formats
1

After crying at every version change of Excel, I adopted this trick to open a .CSV: I rename it to .TXT and the I open it with Excel that does not recognize it and so it open the old import wizard. In some cases can happen that Excel would not open the old import wizard, well, when this occurs I force it by using "text to columns" function.

Surely not the best solution, but with this trick I do not care of the Excel version in use, this method will always function. I also explained this to some "not expert user" and after understanding this trick they had no more problems in importing theirs .CSV files.

just my 2 cents.

-1

In Excel 365, after selecting 'Data'>'From Text/CSV' option, and specifying the CSV file you want to load, when presented with the data Preview screen, be sure to specify the "Data Type Detection" dropdown as "Do not detect data types". This will ensure that excel does not try to interpret the data types in each column (it will leave the data exactly as it appears in your csv file, e.g. leading zeros retained etc). So even though the cells are all formatted as "General", this solution will output the data exactly as it appears in the text file. No messing with renaming file extensions, pasting data, or reformatting columns.

In terms of the power query loading the data into the spreadsheet directly (rather than into an Excel table), a previous answer on this thread to use the "Table Design">"Convert to Range" menu would work just fine (and you only need to select a single cell in the table, not necessarily the entire table to achieve this).

1
  • This does not answer the question asked.
    – Safwan
    Commented May 28 at 19:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .