How to Open a Text File in Excel Without Losing Data

How-to basics · Updated November 21, 2026

To open a text file in Excel for Microsoft 365 on Windows, select Data > Get Data > From File > From Text/CSV, choose your .txt file, check the preview and delimiter, then select Load. This imports the text as worksheet data so you can sort, filter, and work with it in Excel. Before importing, check whether the file uses commas, tabs, or another separator, especially if it contains numbers or codes that must stay unchanged.

What You’ll Need

  • A text file saved on your computer or somewhere you can browse to, such as a .txt file.
  • Microsoft Excel for Microsoft 365 on Windows. The instructions below use this version; Excel for Mac and Excel for the web may show different import options.
  • If the file is large or its layout is unfamiliar, a basic idea of how its fields are separated. Common separators are tabs, commas, semicolons, and spaces.

You do not need to convert the file to .xlsx before importing. Keep the original text file unchanged so you can start over if the import settings need adjusting.

Step-by-Step

  1. Start with a blank workbook or the workbook where you want the data. Open Excel and select the destination workbook. If you want to keep the imported data separate from existing sheets, create a new workbook with File > New > Blank workbook. Importing text adds data to Excel; it does not edit the original .txt file.
  2. Open the text import command. On the ribbon, select Data > Get Data > From File > From Text/CSV. In some Microsoft 365 builds, the first command may appear as Data > From Text/CSV. Both routes open a file browser for selecting a text file.
  3. Select the file. Browse to its folder, select the .txt file, and choose Import. If it is not visible, check that you are looking in the correct folder and that the file browser is not filtering for a different file type. You can also confirm the file extension in File Explorer.
  4. Review the preview before loading. Excel displays a preview of the file. Check that the characters look readable and that the values appear in the expected columns. If everything is in one column, Excel may not have selected the right delimiter. If accented letters or symbols look wrong, the file encoding may need to be changed.
  5. Choose the delimiter and encoding if necessary. In the preview window, use the Delimiter list to select the character separating fields, such as Tab, Comma, or Semicolon. Choose Custom and enter a character only when the file uses a separator that is not listed. If text displays incorrectly, try another option under File Origin (the encoding setting); UTF-8 is common, but the correct choice depends on how the file was saved. Watch the preview as you change options.
  6. Protect values that Excel might reinterpret. If a column contains product codes, postal codes, account numbers, or values with leading zeros, do not assume the preview has preserved them correctly. Select Transform Data to open the Power Query Editor. Select the relevant column, then use Transform > Data Type > Text before loading. This tells Excel to keep entries such as 00127 as text instead of treating them as a number. Review date-like values too; Excel may interpret them as dates based on regional settings.
  7. Load the data and save a workbook copy. If the preview is correct and no changes are needed, select Load. If you used the Power Query Editor, select Home > Close & Load. Excel places the imported data in a worksheet, often as a formatted table. Save the result with File > Save As and choose Excel Workbook (*.xlsx) to retain the data in an Excel workbook. Keep the original .txt file if you may need to import it again.

You can also use File > Open > Browse, change the file-type filter if needed, and select a text file. Excel may show a text import dialog or open the file using the available import experience. This is handy for a quick one-time opening, but the Data import route gives you a preview and a clearer opportunity to check how the text will be divided before it reaches the sheet.

Common Mistakes

  • Loading without checking the delimiter. A tab-separated file imported as comma-separated may place every line in one column, or split values in the wrong places. Inspect a few lines of the source or try another delimiter in the preview.
  • Letting Excel convert identifiers into numbers. A code such as 00042 can become 42 if treated as numeric data. Set that column to Text in Power Query before loading when its exact characters matter. Changing the cell format after zeros have already been removed does not necessarily restore them.
  • Assuming the file extension tells you its structure. A .txt file can contain tab-separated, comma-separated, fixed-width, or other text. The extension alone does not tell Excel which separator to use.
  • Ignoring encoding problems. If punctuation, accented characters, or symbols appear as boxes or odd characters, do not load and save over your source. Try another File Origin setting and confirm the preview looks right first.
  • Saving the imported sheet as a text file by mistake. Use .xlsx when you want to keep multiple sheets, formatting, and Excel features. A text format stores plain text and may discard workbook features.

Tips

  • Check more than the first row. The preview may look correct at the top while later rows contain extra separators, blank lines, or a different number of fields. After loading, compare several records from the beginning, middle, and end with the source.
  • Use Transform Data for repeatable cleanup. Power Query can set column types and remove or rearrange columns before they enter the sheet. If you later refresh the query, those applied steps can be reused, which is useful when importing an updated text file with the same layout.
  • Consider whether separators appear inside field values. Some delimited files use quotation marks around values that contain commas. If the preview splits a quoted phrase incorrectly, check the available delimiter and quote handling in the import settings rather than deleting characters from the source.
  • Keep a copy of the source. Treat the text file as the original and the .xlsx file as your working version. That makes it easier to retry with different settings without losing the original text.
  • For a fixed-width file, inspect the layout carefully. Fixed-width text aligns fields by character position rather than using a separator. If the import preview does not offer a useful fixed-width layout, you may need to use the legacy Text Import Wizard if it is available in your Excel installation, or first determine the field positions from the source file.

Troubleshooting

  • The file appears in one column. Return to the import preview or reopen the import. Test Tab, Comma, Semicolon, or the separator shown in the source. A file that uses spaces between values can be harder to split reliably if field values themselves contain spaces.
  • Columns split in the wrong places. Try a different delimiter and check whether values are enclosed in quotation marks. If the source is fixed-width rather than delimited, selecting a delimiter will not produce a dependable table; use a fixed-width import option where available or inspect the character positions first.
  • Letters or symbols look garbled. Change File Origin in the import preview and inspect the result. If you know how the file was encoded, choose the matching option. Do not rely on reformatting the worksheet to repair incorrectly decoded characters.
  • Leading zeros or long numbers have changed. Reimport from the original text file and set the affected column to Text in Power Query before loading. Excel may also display long numbers in scientific notation or limit numeric precision, so identifiers should be imported as text rather than as numbers.
  • The file is missing from the picker or will not import. Confirm the path, file name, and extension, and close any program that may be holding the file open. If the file is unusually large, try importing it into a new workbook; Excel worksheets have a limit of 1,048,576 rows and 16,384 columns.
  • The commands look different. Excel for Mac has different menus and import options, and Power Query features depend on the Microsoft 365 update. Look under the Data tab for text or CSV import, or use File > Open as an alternative. Excel for the web has more limited local-file import options; use the desktop app for the full text import workflow.

Frequently Asked Questions

Can I open a .txt file directly in Excel?
Yes. Use Data > Get Data > From File > From Text/CSV to inspect and import it, or try File > Open > Browse. The Data route makes it easier to check the delimiter and preview the result.

What is the difference between opening and importing a text file?
A text file contains plain characters rather than Excel workbook features. Importing brings those characters into worksheet cells, where Excel can organize them into rows and columns. Save as .xlsx if you want to preserve the resulting workbook structure.

How do I open a tab-delimited text file?
Start the Text/CSV import and select Tab as the delimiter if Excel does not detect it correctly. Confirm that the preview shows each field in its own column before selecting Load.

Can I keep leading zeros in a text file?
Yes. In the Power Query Editor, select the column and set Transform > Data Type > Text before loading. Reimport from the original text file if Excel has already removed the zeros.

Will opening a text file change the original?
Importing it into a workbook does not normally edit the source .txt file. Save your work as an .xlsx workbook, and keep the original file unchanged so you can reimport it if needed.

Can Excel open a very large text file?
It depends on the number of rows and columns. A worksheet supports up to 1,048,576 rows and 16,384 columns, so a file exceeding those limits cannot fit on one sheet. For a file near or above those limits, use a tool designed to process larger datasets or split the source before importing.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.