Convert CSV to Excel: open or import CSV files into Excel worksheets

In this article you will find 3 quick ways to convert CSV to Excel. You will also learn how to import multiple CSV files in a single workbook and how to handle the cases when some data from a CSV file isn't correctly displayed in an Excel sheet.

Last week we started to investigate the specificities of the comma-separated values format (CSV) and different ways of converting Excel files to CSV. Today, we are going to do the opposite - import CSV to Excel.

This article will show you how to open CSV in Excel and import multiple CSV files at a time. We will also red-flag possible pitfalls along the way and suggest the most effective solutions.

How to convert CSV to Excel

If you need to transfer some data from your company's database to an Excel spreadsheet, exporting the database to a CSV file and then importing the CSV file to Excel is the first option that comes to mind.

There exist 3 ways of converting CSV to Excel: you can open a .csv file directly in Excel, double-click on the file in Windows Explorer, or import CSV into Excel as external data. Below I will provide the detailed guidance on these methods and point out the strengths and limitations of each:

How to open CSV file in Excel

If you created a CSV file in another program, you can still open it as an Excel workbook in the usual way by using the Open command.

Note. Opening the CSV file in Excel does not change the file format. In other words, this won't convert your CSV file to Excel's .xls or .xlsx , the file will retain the original .csv (or .txt) extension.
  1. With your Microsoft Excel open, head over to the File tab and click Open.
  2. The Open dialog box appears and you select Text Files (*.prn,*.txt,*.csv) from the drop-down list in the lower right-hand corner.

    Opening a CSV file in Excel

  3. Browse for the CSV file and open it as usual by double-click.

    If you are opening a .csv file, Excel will open it straight away and display the data in a new workbook.

    If you have selected a text file (.txt), Excel will start the Import Text Wizard. See Importing CSV to Excel for full details.

    Note. When Microsoft Excel opens a .csv file, it uses your default data format settings to understand how exactly to import each column of the text data. If your data contains one of the below characters or entries, then use the Import Text Wizard instead:

    • different delimiters are used in your csv file;
    • the csv file contains different date formats;
    • you convert numbers with leading zeroes and want to preserve leading zeroes in an Excel sheet;
    • you want to see a preview of how your CSV data will be imported into Excel;
    • you are looking for more flexibility in general.

To get Excel to launch the Import Text Wizard, you can either change the file extension from .csv to .txt before opening the file, or import CSV to Excel as explained further.

How to open a CSV file using Windows Explorer

This is the quickest way to open CSV in Excel. In Windows Explorer, just double click a .csv file and have it open as a new workbook.

However, this method works only if you have Microsoft Excel set as the default program for .csv files. If so, then you will see the familiar green Excel icon Excel icon displayed next to the .csv file's name in Windows Explorer.

If Excel is not the default program, you can set it as such in this way:

  1. Right-click any .csv file in Windows Explorer, and select Open with… > Choose default program from the context menu.
  2. Click Excel (desktop) under Recommended Programs, make sure the "Always use the selected program to open this kind of file" is selected and click OK.

    Setting Microsoft Excel as the default program to open .csv files.

How to import CSV to Excel

Using this method you can import data from a csv file into the existing or a new Excel worksheet. Unlike the previous two methods, it does not simply open CSV in Excel but really converts a .csv file to .xlsx (in Excel 2016, 2013, 2010 or 2007) or .xls (in case of Excel 2003 and lower).

  1. With the needed spreadsheet open, click the cell where you want to import the data from a .csv or .txt file.
  2. On the Data tab, in the Get External Data group, click From Text.
    To convert a CSV file to excel, click From Text on the Data tab.
  3. Browse for the csv file you want to import, select it and click the Import button (or simply double click the .csv file).
    Double click the .csv file to run the Text Import Wizard.
  4. The Text Import Wizard will appear and you follow its steps.

    Before we move further, please have a quick look at the screenshot below that shows the original CSV file and the desired result in Excel. Hopefully, this will help you better understand why we choose this or that setting in the example that follows.
    Data to be converted from CSV to Excel

    • Step 1. Choose the file type and the row number to start importing the data. Typically, you choose Delimited and row 1, respectively. The preview window in the lower part of the wizard shows the first few entries of your CSV file.
      Choose the file type and the row number to start importing the data from CSV to Excel.
    • Step 2. In this step, you select a delimiter(s) and text qualifier. Delimiter is the character that separates values in your .csv file. If your CSV file uses some character other than available in the pre-defined list, select the Other check box and then type your custom character. In our example, we specify Tab and Comma since we want each product (separated by tabs) to start with a new row and the product details such as IDs and sales numbers (separated by commas) to be imported in separate cells.

      Text qualifier is the character that wraps the values in your text file. All text enclosed in the text qualifier symbols, e.g. "text1, text2" will be imported as one value, even if the text contains a delimiter you specified.In this example, we have chosen a comma as the delimiter and a quotation mark as the text qualifier. As the result, all of the numbers with a decimal separator (which is also a comma in our case!) will be imported in one cell, as you can see in the preview section below. If we did not specify the quotation mark as the text qualifier, then all the numbers with decimal separators would be imported into two adjacent cells.

      Sect the delimiter and text qualifier

    • Step 3. If you are happy with the Data preview, then click the Finish button.
    Tip. If more than one consecutive comma or other delimiter characters may occur in your CSV file, then check Treat consecutive delimiters as one check box to prevent empty cells.
  5. Choose the destination for the imported data, either an existing or a new worksheet, and click OK to finish importing your CSV file to Excel.
    Choose the destination and click OK to finish importing your CSV file to Excel.

    Tip. You can click Properties… to set some advanced options such as refresh, layout and formatting for the imported data.
    Click the Properties button to set advanced options for the imported data.
    Note. If your CSV file contains some numerical data or dates, Excel may not convert these values correctly. To change the format of the imported data, select the problematic column(s) in Excel, right click and choose Format cells from the context menu.

Convert CSV to Excel: problems and solutions

The CSV format has been around for over 30 years, but notwithstanding its long history it has never been officially documented. The name CSV (comma-separated values) implies the use of comma to separate data fields. But this is in theory. De facto, many so-called "CSV" files use other characters to separate data, such as:

  • Tabs - TSV files (tab-separated values)
  • Semicolon - SCSV files (semicolon separated values)

Some implementations of CSV files wrap data fields in single or double quotation marks, while others require a Unicode byte order mark (BOM), e.g. UTF-8, for correct Unicode interpretation.

This lack of standard spawns various problems you may be faced with when trying to convert an Excel file to CSV and especially when importing a .csv file to Excel. Let's investigate these issues beginning with the most common one.

CSV file is incorrectly displayed in Excel

Symptoms. You are trying to open a .csv file in Excel and all of the data is displayed in the first column.

Cause. The root of the problem is different separators set in your Windows regional and language settings and the csv file. In North America and some other countries, the default List Separator is a comma. While in European countries the comma (,) is reserved as the Decimal Symbol and the List Separator is set to semicolon (;).

Solutions. There are several possible solutions for this problem, you can quickly look through the recommendations below and choose the one most suited for your particular task.

  1. Specify the right separator directly in the CSV file. Open the CSV file with any text editor (even the usual Notepad will do) and add the below text in the first line. Note, it should be a separate line before any data:
    • To separate with comma: sep=,
    • To separate with semicolon: sep=;

    As you can guess, you can set any other custom separator in the same way, simply type it after the equality sign.

  2. Choose the needed separator in Excel. In Excel 2016, 2013 or 2010, go to the Data tab > Data Tools group > Text To Columns.
    Run the Text To Columns wizard in Excel.

    The Convert Text to Column wizard, choose the Delimited file type ad click Next. Then select the needed separator in the next step and click Finish.
    Select the needed separator for the CSV file.

  3. Change the .csv extension to .txt. Opening a .txt file in Excel will start the Text Import Wizard and you can choose any delimiter as discussed in importing a csv file to Excel.
  4. Open a semicolon delimited CSV file with VBA.

    Here is a sample VBA code to open a semicolon delimited CSV file in Excel. Though the code was written a few years ago for older Excel versions (2000 and 2003), if you are pretty comfortable with VBA, you won't have problems with updating it or modifying for comma delimited CSV files.

    Note. All of the solutions above change the separator for a given CSV file only. If you'd rather change the default separator once and for all, proceed with solution 5.
  5. Change separators in Region and Language settings.

    Click the Start button and open the Control Panel, then click Region and Language > Additional Settings. The customize Format dialog window will open and you choose a dot (.) as the Decimal symbol and a comma (,) as the List separator.

    Change separators in Windows Region and Language settings.

    Click OK twice to close two dialog windows and you are finished. From now Microsoft Excel will open and display all CSV (comma separated) files correctly.

    Note. Setting new decimal and list separators in Control Panel changes the default separator characters for all programs on your computer, not only Microsoft Excel.

Leading zeros are lost when opening a CSV file in Excel

Symptom. Your .csv file contains values with leading zeros and those zeros are lost when you open the CSV file in Excel.

Cause. By default, Microsoft Excel displays SCV files in the General format, which cuts off leading zeros.

Solution. Instead of opening a .csv file in Excel, run the Text Import Wizard as explained in Importing CSV to Excel in order to convert CSV to Excel.

In step 3 of the wizard, select the column(s) that contains values with leading zeros and change the column's format to Text. This will covert your CSV file to Excel keeping all zeros in place.
Convert  a CSV file to Excel keeping all leading zeros intact.

Excel converts some values to dates when opening a CSV file

Symptom. Some values in your .csv file look like dates and Excel automatically converts such values from text to a date.

Cause. As mentioned above, Excel opens CSV files in the General format and converts values that happen to resemble dates from text to a date. For example, if you are opening a .CSV file containing user logins, the entries similar to apr23 will be converted to dates in Excel.

Solution. Convert CSV to an Excel file by running the Text Import Wizard (Data tab > From Text). In step 3, select the column(s) with records that look enough like dates and change the column's format to Text.

Change the column's format to Text

If you are looking for the opposite, i.e. you want the values in a certain column to be converted to dates in Excel, then set the format of that column to Date and choose the desired date format from the drop-down list.

How to import multiple csv files into Excel

As you probably know, Microsoft Excel allows opening several CSV files using the Open command.

  1. You click File > Open and select Text Files (*.prn, *.txt, *.csv) from the drop down list in the lower right-hand corner.
  2. To select adjacent files, click the 1st file, hold down the Shift key, and then click the last file. Both of the clicked files as well as all the files in-between will get selected.

    To select multiple non-adjacent files, hold down the Ctrl and click each .csv file you want to open.

  3. With multiple CSV files selected, click the Open button.
    Opening multiple csv files into Excel

    This method is straightforward and quick and we could call it perfect but for one small thing - it opens each CSV file as a separate Excel workbook. In practice, switching back and forth between several Excel files might be quite inconvenient and burdensome.

Now let me show you how you can import multiple CSV files into one Excel workbook, placing each .csv file on a separate sheet or consolidating all the files in a single spreadsheet.

Import multiple CSV files into a single Excel workbook

To quickly import several .csv files into one workbook, we are going to use the Copy Sheets tool included with our Ultimate Suite for Excel. This add-in works with all versions of Excel 2019, 2016, 2013, and 2010.

The evaluation version is available for download, so you can follow the steps more closely. After installation, the Ablebits Data tab will be added to your Excel ribbon, and you will find the Copy Sheets button on it.

Importing will take you 3 minutes at the most, a minute per step :)

  1. Click Copy Sheets drop-down arrow and select exactly how you want to import CSV files. Usually, that would be either the 3rd or 4th option:
    • To import all of the selected CSV files into one workbook, each file on a separate sheet, choose Selected sheets to one workbook.
    • To place data from multiple CSV files onto a single worksheet, choose Data from the selected sheets to one sheet.

     Choose how to import the selected CSV files to a single workbook.

  2. Select the CSV files to import. If you have the files open, their names will be displayed in the dialog window. Otherwise, click the Add files… button near the bottom. When done, click Next.
    Select the CSV files to import.
  3. Finally, the add-in will ask you to specify exactly how you want to paste the data. When importing .csv files, you typically go ahead with the default Paste all setting, and just click Copy.
    Choose how to import the data in Excel.

Allow the tool a few seconds and get the desired result - multiple CSV files imported into one Excel workbook. Fast and painless, isn't it?
Multiple CSV files are imported into one Excel workbook.

Hopefully, now you are able to convert any CSV files to Excel with ease. If you have any questions or have run into any issues, don't hesitate to drop me a comment. And thanks for your patience everyone who has read this long tutorial to the end! : )

You may also be interested in