How to import files to excel

Import or export text (.txt or .csv) files

There are two ways to import data from a text file with Excel: you can open it in Excel, or you can import it as an external data range. To export data from Excel to a text file, use the Save As command and change the file type from the drop-down menu.

There are two commonly used text file formats:

  • Delimited text files (.txt), in which the TAB character (ASCII character code 009) typically separates each field of text.

  • Comma separated values text files (.csv), in which the comma character (,) typically separates each field of text.

You can change the separator character that is used in both delimited and .csv text files. This may be necessary to make sure that the import or export operation works the way that you want it to.

Note: You can import or export up to 1,048,576 rows and 16,384 columns.

Import a text file by opening it in Excel

You can open a text file that you created in another program as an Excel workbook by using the Open command. Opening a text file in Excel does not change the format of the file — you can see this in the Excel title bar, where the name of the file retains the text file name extension (for example, .txt or .csv).

  1. Go to File > Open and browse to the location that contains the text file.

  2. Select Text Files in the file type dropdown list in the Open dialog box.

  3. Locate and double-click the text file that you want to open.

    • If the file is a text file (.txt), Excel starts the Import Text Wizard. When you are done with the steps, click Finish to complete the import operation. See Text Import Wizard for more information about delimiters and advanced options.

    • If the file is a .csv file, Excel automatically opens the text file and displays the data in a new workbook.

      Note: When Excel opens a .csv file, it uses the current default data format settings to interpret how to import each column of data. If you want more flexibility in converting columns to different data formats, you can use the Import Text Wizard. For example, the format of a data column in the .csv file may be MDY, but Excel’s default data format is YMD, or you want to convert a column of numbers that contains leading zeros to text so you can preserve the leading zeros. To force Excel to run the Import Text Wizard, you can change the file name extension from .csv to .txt before you open it, or you can import a text file by connecting to it (for more information, see the following section).

Import a text file by connecting to it (Power Query)

You can import data from a text file into an existing worksheet.

  1. On the Data tab, in the Get & Transform Data group, click From Text/CSV.

  2. In the Import Data dialog box, locate and double-click the text file that you want to import, and click Import.

  3. In the preview dialog box, you have several options:

    • Select Load if you want to load the data directly to a new worksheet.

    • Alternatively, select Load to if you want to load the data to a table, PivotTable/PivotChart, an existing/new Excel worksheet, or simply create a connection. You also have the choice of adding your data to the Data Model.

    • Select Transform Data if you want to load the data to Power Query, and edit it before bringing it to Excel.

If Excel doesn’t convert a particular column of data to the format that you want, then you can convert the data after you import it. For more information, see Convert numbers stored as text to numbers and Convert dates stored as text to dates.

Export data to a text file by saving it

You can convert an Excel worksheet to a text file by using the Save As command.

  1. Go to File > Save As.

  2. Click Browse.

  3. In the Save As dialog box, under Save as type box, choose the text file format for the worksheet; for example, click Text (Tab delimited) or CSV (Comma delimited).

    Note: The different formats support different feature sets. For more information about the feature sets that are supported by the different text file formats, see File formats that are supported in Excel.

  4. Browse to the location where you want to save the new text file, and then click Save.

  5. A dialog box appears, reminding you that only the current worksheet will be saved to the new file. If you are certain that the current worksheet is the one that you want to save as a text file, click OK. You can save other worksheets as separate text files by repeating this procedure for each worksheet.

    You may also see an alert below the ribbon that some features might be lost if you save the workbook in a CSV format.

For more information about saving files in other formats, see Save a workbook in another file format.

Import a text file by connecting to it

You can import data from a text file into an existing worksheet.

  1. Click the cell where you want to put the data from the text file.

  2. On the Data tab, in the Get External Data group, click From Text.

  3. In the Import Data dialog box, locate and double-click the text file that you want to import, and click Import.

    Follow the instructions in the Text Import Wizard. Click Help button image on any page of the Text Import Wizard for more information about using the wizard. When you are done with the steps in the wizard, click Finish to complete the import operation.

  4. In the Import Data dialog box, do the following:

    1. Under Where do you want to put the data?, do one of the following:

      • To return the data to the location that you selected, click Existing worksheet.

      • To return the data to the upper-left corner of a new worksheet, click New worksheet.

    2. Optionally, click Properties to set refresh, formatting, and layout options for the imported data.

    3. Click OK.

      Excel puts the external data range in the location that you specify.

If Excel does not convert a column of data to the format that you want, you can convert the data after you import it. For more information, see Convert numbers stored as text to numbers and Convert dates stored as text to dates.

Export data to a text file by saving it

You can convert an Excel worksheet to a text file by using the Save As command.

  1. Go to File > Save As.

  2. The Save As dialog box appears.

  3. In the Save as type box, choose the text file format for the worksheet.

    • For example, click Text (Tab delimited) or CSV (Comma delimited).

    • Note: The different formats support different feature sets. For more information about the feature sets that are supported by the different text file formats, see File formats that are supported in Excel.

  4. Browse to the location where you want to save the new text file, and then click Save.

  5. A dialog box appears, reminding you that only the current worksheet will be saved to the new file. If you are certain that the current worksheet is the one that you want to save as a text file, click OK. You can save other worksheets as separate text files by repeating this procedure for each worksheet.

  6. A second dialog box appears, reminding you that your worksheet may contain features that are not supported by text file formats. If you are interested only in saving the worksheet data into the new text file, click Yes. If you are unsure and would like to know more about which Excel features are not supported by text file formats, click Help for more information.

For more information about saving files in other formats, see Save a workbook in another file format.

The way you change the delimiter when importing is different depending on how you import the text.

  • If you use Get & Transform Data > From Text/CSV, after you choose the text file and click Import, choose a character to use from the list under Delimiter. You can see the effect of your new choice immediately in the data preview, so you can be sure you make the choice you want before you proceed.

  • If you use the Text Import Wizard to import a text file, you can change the delimiter that is used for the import operation in Step 2 of the Text Import Wizard. In this step, you can also change the way that consecutive delimiters, such as consecutive quotation marks, are handled.

    See Text Import Wizard for more information about delimiters and advanced options.

If you want to use a semi-colon as the default list separator when you Save As .csv, but need to limit the change to Excel, consider changing the default decimal separator to a comma — this forces Excel to use a semi-colon for the list separator. Obviously, this will also change the way decimal numbers are displayed, so also consider changing the Thousands separator to limit any confusion.

  1. Clear Excel Options > Advanced > Editing options > Use system separators.

  2. Set Decimal separator to , (a comma).

  3. Set Thousands separator to . (a period).

When you save a workbook as a .csv file, the default list separator (delimiter) is a comma. You can change this to another separator character using Windows Region settings. 

Caution: Changing the Windows setting will cause a global change on your computer, affecting all applications. To only change the delimiter for Excel, see Change the default list separator for saving files as text (.csv) in Excel.

  1. In Microsoft Windows 10, right-click the Start button, and then click Settings.

  2. Click Time & Language, and then click Region in the left panel.

  3. In the main panel, under Regional settings, click Additional date, time, and regional settings.

  4. Under Region, click Change date, time, or number formats.

  5. In the Region dialog, on the Format tab, click Additional settings.

  6. In the Customize Format dialog, on the Numbers tab, type a character to use as the new separator in the List separator box.

  7. Click OK twice.

  1. In Microsoft Windows, click the Start button, and then click Control Panel.

  2. Under Clock, Language, and Region, click Change date, time, or number formats.

  3. In the Region dialog, on the Format tab, click Additional settings.

  4. In the Customize Format dialog, on the Numbers tab, type a character to use as the new separator in the List separator box.

  5. Click OK twice.

Note:  After you change the list separator character for your computer, all programs use the new character as a list separator. You can change the character back to the default character by following the same procedure.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

See Also

Import data from external data sources (Power Query)

Need more help?

How to Import Data in Excel?

Importing the data from another file or another source file is often required in Excel. For example, sometimes people need data directly from very complicated servers, and sometimes we may need to import data from a text file or even from an Excel workbook.

If you are new to Excel data importing, then in this article, we will take a tour of importing data from text files, different Excel workbooks, and MS Access. Follow this article to learn the process involved in importing the data.

Table of contents
  • How to Import Data in Excel?
    • #1 – Import Data from Another Excel Workbook
    • #2 – Import Data from MS Access to Excel
    • #3 – Import Data from Text File to Excel
    • Things to Remember 
    • Recommended Articles

Import Data into Excel

#1 – Import Data from Another Excel Workbook

You can download this Import Data Excel Template here – Import Data Excel Template

Let us start.

  1. First, we must go to the DATA tab. Then, under the DATA tab, click on Connections.

    Import Data Example 1

  2. As soon as we click on Connections, we may see the below window separately.

    Import Data Example 1-1

  3. Now, click on Add.

    Import Data Example 1-2

  4. It will open up a new window. In the below window, select All Connections.

    Import Data Example 1-3

  5. If there are any connections in this workbook, it will show what those connections are here.

    Import Data Example 1-4

  6. Since we are connecting to a new workbook, click on Browse for more.

    Import Data Example 1-5

  7. In the below window, browse the file location. Then, click on Open.

    Import Data Example 1-6

  8. After clicking on Open, it shows the below window.

    Import Data Example 1-7

  9. Here, we need to select the required table to be imported to this workbook. Select the table and click on OK.

    Import Data Example 1-8

    After clicking on OK, close the Workbook Connection window.

  10. Then, go to Existing Connections under the DATA tab.

    Import Data Example 1-9

  11. Here, we will see all the existing connections. Select the connection we have just made and click on Open.

    Import Data Example 1-10

  12. Once we click on Open, it will ask us where to import the data. First, we need to select the cell reference here. Then, click on the OK button.

    Import Data Example 1-11

  13. It will import the data from the selected or connected workbook.

    Import Data Example 1-12

Like this, we can connect to the other workbook and import the data.

#2 – Import Data from MS Access to Excel

MS Access is the main platform to store the data safely. We can import the data directly from the MS Access File itself whenever the data is required.

Step 1: Go to the “DATA” ribbon in excelThe ribbon is an element of the UI (User Interface) which is seen as a strip that consists of buttons or tabs; it is available at the top of the excel sheet. This option was first introduced in the Microsoft Excel 2007.read more and select “From Access.

Import Data Example 2

Step 2: Now, it will ask us to locate the desired file. Select the desired file path. Then, click on “Open.”

Import Data Example 2-1

Step 3: Now, it will ask us to select the desired destination cell where we want to import the data. Then, click on “OK.”

Import Data Example 2-2

Step 4: It will import the data from access to the A1 cell in Excel.

Import Data Example 2-3

#3 – Import Data from Text File to Excel

In almost all the corporations, whenever we ask for the data from the IT team, they will write a query and get the file in TEXT format. But unfortunately, TEXT file data is not the ready format to use in Excel; we need to make some modifications to work on it.

Step 1: Go to the “DATA” tab and click on “From Text.”

Example 3

Step 2: Now, it will ask us to choose the file location on the computer or laptop. Select the targeted file, then click on “Import.”

Example 3-1

Step 3: It will open up a “Text Import Wizard.”

Text Import Wizard - Step 1 of 3

Step 4: By selecting the “Delimited,” click on “Next.”

Text Import Wizard - Step 1 of 3

Step 5: In the next window, select the other and mention comma (,) because, in the text file, each column is separated by a comma (,). Then click on “Next.”

Text Import Wizard - Step 2 of 3

Step 6: In the next window, click on “Finish.”

Text Import Wizard 3-5

Step 7: Now, it will ask us to select the desired destination cell where we want to import the data. Select the cell and click on “OK.”

Example 3-6

Step 8: It will import the data from the text file to the A1 cell in Excel.

Example 3-7

Things to Remember

  • If there are many tables, we must specify which table data we need to import.
  • If we want the data in the current worksheet, we need to select the desired cell. Else, if we need data in a new worksheet, we must choose the new worksheet as the option.
  • We need to separate the column in the TEXT file by identifying the common column separators.

Recommended Articles

This article is a guide to Import Data in Excel. Here, we discuss how to import data from 1) Excel Workbook, 2) MS Access, 3) Text File, practical examples, and a downloadable Excel template. You may learn more about Excel from the following articles: –

  • KPI Dashboard in Excel
  • Insert Image in Excel Cell
  • How to Insert New Worksheet In Excel?
  • Create a Dashboard in Excel
  • Page Numbers in Excel


How to Import & Export Data into Excel

Excel can import and export many different file types aside from the standard .xslx format. If your data is shared between other programs, like a database, you may need to save data as a different file type or bring in files of a different file type.

Export Data

When you have data that needs to be transferred to another system, export it from Excel in a format that can be interpreted by other programs, such as a text or CSV file.

  1. Click the File tab.

    Import and Export Data

  2. At the left, click Export.
  3. Click the Change File Type.
  4. Under Other File Types, select a file type.
    • Text (Tab delimited): The cell data will be separated by a tab.
    • CSV (Comma delimited): The cell data will be separated by a comma.
    • Formatted Text (space delimited): The cell data will be separated by a space.
    • Save as Another File Type: Select a different file type when the Save As dialog box appears.

    The file type you select will depend on what type of file is required by the program that will consume the exported data.

  5. Click Save As.

    Import and Export Data

  6. Specify where you want to save the file.
  7. Click Save.

    Import and Export Data

    A dialog box appears stating that some of the workbook features may be lost.

  8. Click Yes.

Import Data

Excel can import data from external data sources including other files, databases, or web pages.

  1. Click the Data tab on the Ribbon..
  2. Click the Get Data button.

    Some data sources may require special security access, and the connection process can often be very complex. Enlist the help of your organization’s technical support staff for assistance.

  3. Select From File.
  4. Select From Text/CSV.

    Import and Export Data

    If you have data to import from Access, the web, or another source, select one of those options in the Get External Data group instead.

  5. Select the file you want to import.
  6. Click Import.

    If, while importing external data, a security notice appears saying that it is connecting to an external source that may not be safe, click OK.

    Import and Export Data

  7. Verify the preview looks correct.

    Because we’ve specified the data is separated by commas, the delimiter is already set. If you need to change it, it can be done from this menu.

  8. Click Load.

    Import and Export Data


Excel Cheat Sheet

FREE Quick Reference

Click to Download

Free to distribute with our compliments; we hope you will consider our paid training.

Skip to content

How to Import Text Files Into Excel: Step-by-Step Guide (2023)

How to Import Text Files Into Excel: Step-by-Step Guide (2023)

Don’t you just wish you can magically import data that you need into a new usable format faster with nothing to do any manual work? 😩

Well, Microsoft Excel can grant your wish. Excel allows you to open other file formats such as comma-separated values (CSV) files and tab-separated (TXT) files. You can also import data from a text file by converting them into an Excel spreadsheet you can now work with.

Sounds awesome, right? 😀

Learn how to import data from a text file into Excel with our step-by-step guide.

Download this free practice workbook we’ve prepared for you to get started.

How to import a text or CSV file in Excel

Before you learn how to import a text file into Excel, you need to learn the basics of the text file formats first.

What is a text or CSV file?

Text files are formatted in a very specific way so they can be read by programs like Microsoft Excel. There are different text file formats. The commonly used ones are:

  • Comma-separated values text files (.csv), in which the comma character (,) typically separates each field of text.
  • Delimited text files (.txt), in which the TAB character typically separates each field of text.

Now, how does Excel reads data from a text or CSV file? 🤔

Each line of the file is a “record”. In Excel, that means it’s a row. Records are delineated by line breaks. Each line break corresponds to one row in Excel.

Delimiters such as commas, tabs, or space characters separate fields within the record. CSV files are comma delimited.

So, when Excel sees “Excel,CSV,Formatting”, it will import data in an Excel worksheet like this:

imported data in excel file

You can change the separator character that is used in CSV files or text files. This may be necessary to make sure that the import or export operation works the way that you want it to.

You can import or export up to 1,048,576 rows and 16,384 columns 👍

The only other notable thing about CSV files is that the double quote symbol indicates text fields. That’s important because text fields can contain commas and line breaks.

If they’re contained within quotes, commas, and line breaks won’t end the field or the record.

Kasper Langmann, Microsoft Office Specialist

Prepare the Text File

Of course, in a real-life setting, you don’t need to prepare the text file. You may have already downloaded it in TXT or CSV file formats waiting to be imported into an Excel file.

For our tutorial, let’s open a Notepad File to create a sample text file. If you’re using Mac, open TextEdit📝

Type the following data in your notepad as shown below. Or copy this and paste it into your notepad.

Last Name,First Name,Address
Reed,James,Washington
Owens,Donovan,Texas
Hutchins,Ricky,Wisconsin

text file

Then save this text file to be used later.

There are two ways to import data from a text file with Excel: you can open it in Excel, or you can import it as an external data range. Let’s try to do each one of them 😊

Import a text or CSV file by opening it in Excel

The first way you can import text files in Excel is rather simple.

Just open a CSV file or a text file that you created in another program as an Excel workbook by using the Open command.

Open your practice workbook and do the following steps 👇

  1. Go to File Tab.
go to file in Excel
  1. Click Open.
  2. Browse to the location that contains the text file.
open command

The Open dialog box pops up.

  1. Locate and double-click the text file that you want to open.
open dialog box

If you open a CSV file, Excel automatically opens the text file and displays the data in a new workbook. If the file is a text file, Excel starts the Text Import Wizard.

Kasper Langmann, Microsoft Office Specialist

Since our file is a text file, the Text Import Wizard window pops up 🧙

There are 3 steps to go through. Let’s start with Step 1 out of 3.

The Text Import Wizard has determined that our data is Delimited. But to be sure:

  1. Click Delimited for the Original Data Type.
comma delimited
  1. Click Next to proceed to Step 2.
import text wizard
  1. Click Comma as the delimiter.
comma delimited

The window will also show a Data Preview Field.

  1. Click Next to proceed to Step 3.
import text wizard

Here you can select individual columns and apply specific formatting by clicking them and choosing an option from the Column data format list.

We’ll leave it as General, which is what you’ll most often use.

  1. Select General.
column data format
  1. Finally, click Finish to get your data.
click finish

This is now the result. The imported data is now in a new blank worksheet, not in your existing worksheet 😀

new excel workbook

Opening a text file in Excel does not change the format of the file — you can see this in the Excel title bar, where the name of the file retains the text file name extension (for example, .txt or .csv).

Kasper Langmann, Microsoft Office Specialist
text format

Simple, right? 😊

Import a text or CSV file by connecting to it (Power Query)

You can also import data from a text file into an existing worksheet.

  1. Go to Data Tab.
  2. Click the Get Data drop-down button in the Get & Transform Data group.
data tab
  1. Select From File.
  2. Select From Text/CSV.
open txt file or csv file in excel
  1. In the Import Data dialog box, locate and double-click the text file that you want to import, and click Import.
click import

In the preview dialog box, you have several options:

  • Select Load if you want to load the data directly to a new worksheet.
  • Select Load to if you want to load the data to a table, PivotTable/PivotChart, an existing worksheet, a new Excel worksheet, or simply create a connection. You also have the choice of adding your data to the Data Model.
  • Select Transform Data if you want to load the data to Power Query, and edit it before bringing it to Excel.
  1. Click Transform Data.
transform data group

The Text Power Query Editor window will pop up. It shows the data preview as well.

data preview field

The data are already separated as you can see 👀

In the case that the data are NOT separated as they should be, here’s what to do: 👇

  1. Click the Split column button.
  2. Select By delimiter from the drop-down list.
comma delimited
  1. Select Comma as the delimiter.
comma separated values
  1. Click OK.
click ok

Look at the preview to check if it’s good to go.

text editor - power query

As you can see, it added another unnecessary column. To remove or undo any changes you’ve done, head over to the Query Setting panel on the right side of the window.

Click the ❌ symbol. This will remove or undo any applied steps.

text editor - power query

Look at the data preview again. If everything looks good…

  1. Finally, click the Close & Load button.
data preview field

Now, this is what it will look like. The data is imported into a new worksheet in the current Excel workbook 😊

import data in Microsoft Excel

That’s it – Now what

Clearly, Microsoft Excel helps you import data from text files with just a few clicks. This saves you from manually typing data from other file formats by converting them to a usable file format you can work on 👍

If this sounds awesome already, then you are in for a big surprise! Excel can actually help you do 50 tasks all at once with just a single click 🤯

That’s right, this is possible with Excel Mighty Macros. It’s perfect for your workflow automation. Learn how to record, and edit a macro, the basics of the VBA editor, and learn how to write your first macro from scratch. Learn it all with me!

Join my free email course to get started with macros. It’s free and perfect for beginners 😊

Kasper Langmann2023-02-02T18:55:50+00:00

Page load link

This article will show you how to easily add/attach file like PDF, Word or any other to Excel spreadsheet.

Applies to: Excel, Excel 2013, Excel 2016, Excel 2019, Excel 365, Office 365

  1. Go to Insert tab


    Excel 2016/2019/365 - Home tab

    Excel 2016/2019/365 — Home tab

  2. Click Object button placed in Text group.

    Narrow window

    Insert Object button - narrow window

    Insert Object button — narrow window

    Medium width window

    Insert Object button - medium width window

    Insert Object button — medium width window

    Maximum width window

    Insert Object button - max width window

    Insert Object button — max width window

  3. Click Create from file and browse for the file.


    Object window in Excel

    Click to enlarge

Понравилась статья? Поделить с друзьями:
  • How to import file in excel
  • How to import csv to excel
  • How to images in word
  • How to html to excel
  • How to highlight using word