To open a TXT file in Excel for Microsoft 365 on Windows, choose Data > From Text/CSV, select the file, check the delimiter and preview, then click Load. If the file contains IDs, codes, or dates that must stay exactly as written, use Transform Data first to set those columns to Text before loading.
A TXT file is plain text: it may contain one value per line, or rows of values separated by tabs, commas, semicolons, or another character. Importing it through Excel’s data tools gives you a chance to choose how those characters divide the data, rather than letting Excel guess and possibly alter values.
What You’ll Need
- Microsoft Excel for Microsoft 365 desktop on Windows, with the TXT file saved somewhere you can access.
- A rough idea of how fields are separated in the file. Common separators include tabs, commas, and semicolons. If you do not know, you can inspect the file in Notepad.
- Optional: the original TXT file kept unchanged until you have checked the imported workbook. This gives you a clean source to return to if Excel interprets a column incorrectly.
The steps below use Excel’s modern import tool. Menu labels and availability can differ between Excel builds. In Excel for Mac, look for the text-import option under the Data tab or File > Import; if the same preview controls are not available, use Excel desktop on Windows for the steps shown here. Excel for the web does not provide the same full desktop text-import workflow.
Step-by-Step
-
Start a blank workbook or open the workbook where the data belongs. Importing into a blank workbook is a good choice if you are unsure where the results should go. If you are adding the text data to an existing workbook, select the sheet you want to use. The import can create a new worksheet, so you do not need to select a specific cell unless you plan to place the results in an existing location.
-
Open the text import command. On the ribbon, choose Data > From Text/CSV. In the file picker, browse to the TXT file, select it, and choose Import. If you cannot see the file, check the folder and change the file-type filter to include text files or all files. You can import a file with a .txt extension even if the picker initially shows only CSV files.
-
Check the preview before loading. Excel opens an import preview showing how it has interpreted the file. Confirm that records appear on separate rows and that related values appear in separate columns. If the entire line is in one column, Excel may not have identified the separator. If a single field has been split in the wrong place, the delimiter selection may not match the file’s structure.
-
Choose the delimiter that matches the text. In the preview window, use the Delimiter control to select Tab, Comma, Semicolon, or another available separator. For example, a line such as
Rita,West,4821is comma-delimited, whileRitauses tabs. If the file uses a less common separator, select the custom option if available and enter the character. Watch the preview update after each change; the right choice makes each field land in its own column without splitting the contents of a field unnecessarily.West 4821 -
Check the text encoding if characters look wrong. Accented letters or symbols that appear as question marks or odd characters usually point to an encoding mismatch. In the import window, try a different File Origin or encoding option, such as UTF-8, and compare the preview. Choose the option that displays names and symbols correctly. Do not load the file until the preview is readable, because changing the encoding after import will not reliably restore characters that were read incorrectly.
-
Protect columns that must remain unchanged. If the TXT file contains account numbers, postal codes, product codes, or values with leading zeros, do not rely on Excel’s automatic type detection. Click Transform Data to open Power Query Editor. Select the relevant column, then use Transform > Data Type > Text. For dates or numeric fields, choose a suitable type only after checking how the source is formatted. Setting an identifier to Text prevents Excel from turning a value such as 00482 into 482.
-
Load the data into the workbook. If the preview is correct and you do not need to adjust types, choose Load. Excel will usually put the imported data into a table on a new worksheet. If you used Transform Data, make any needed changes in Power Query Editor, then choose Home > Close & Load. To select a destination, use the arrow next to Load or the Close & Load options and choose the available load destination, such as a table in a new or existing worksheet.
-
Review the imported sheet and save a workbook copy. Check the first and last few rows, column headings, and any values with leading zeros, long numbers, dates, or special characters. If everything is right, choose File > Save As and save the result as an Excel Workbook (*.xlsx). The TXT file is still plain text; saving as XLSX creates a separate workbook that can retain formatting, formulas, and imported table settings.
Common Mistakes
Accepting the first delimiter guess: A preview with everything in column A is a sign to check the delimiter, not a reason to start splitting cells by hand. Choose the separator used in the source and inspect the preview again.
Letting Excel change identifiers: Excel may interpret digit-only codes as numbers and remove leading zeros. It can also display long digit strings in scientific notation. Import those columns as Text, then reimport from the original TXT if the values have already changed; formatting the altered value as text cannot bring removed zeros back.
Confusing a space with a tab: A row can look spaced out in a text editor because tabs create visual gaps. Choosing Space as the delimiter may break names or phrases into too many columns. Try Tab first when fields appear aligned in vertical positions.
Loading without checking the character encoding: If a person’s name or a symbol is already garbled in the preview, loading it will not fix the problem. Select an encoding that displays the source correctly before importing.
Tips
- Inspect a copy in Notepad first. A quick look at a few lines can reveal whether fields are separated by tabs, commas, or another character. Do not edit and save the original just to inspect it.
- Use the preview as your quality check. Check a typical row and an unusual row, such as one with a blank field, punctuation, or a longer description. A delimiter can work for most rows but still split a field that contains the same character.
- Keep source values as text when they are labels. Postal codes, phone numbers, and inventory IDs are usually identifiers, not values to calculate with. Text preserves their original characters and leading zeros.
- Keep the import connection if the file will be refreshed. Loading with Excel’s data tools can leave a query in the workbook. When the TXT file is updated, use Data > Refresh All to refresh connected data. If the file is moved or renamed, Excel may need you to update the source location first.
- Choose a sensible destination. A new worksheet is safer when you are not certain how much data the file contains. It reduces the chance of overwriting existing content and makes the imported range easier to inspect.
Troubleshooting
Everything appears in one column: Return to the import preview or query settings and select the correct delimiter. If the source is tab-separated, select Tab rather than Space. For files that use fixed-width columns instead of a separator, the modern delimiter import may not be the best fit. On Windows, you can enable the legacy text import wizard through File > Options > Data > Show legacy data import wizards, then use Data > Get Data > Legacy Wizards > From Text (Legacy). In that wizard, choose Fixed width and set the column breaks to match the file.
Columns split in the wrong places: Try another delimiter and check whether the text uses a quote character around fields. A comma inside a quoted description, for example, should not necessarily separate two fields. Review the text qualifier setting in the import options, and choose the quote character used by the source. If the source is inconsistent, you may need to correct or standardize a copy of the text before importing.
Zeros disappear or numbers change: Cancel or undo the import if possible, then import again from the original TXT. Use Transform Data to set the affected column to Text before loading. Once Excel has converted 00073 to 73, changing the cell format does not restore the missing zeros. For very long digit strings, Text also avoids Excel’s limit on numeric precision.
Letters or symbols are corrupted: Reopen the original file through Data > From Text/CSV and change File Origin or encoding until the preview is correct. If no choice fixes it, confirm how the file was created; it may use an encoding that Excel does not identify automatically. Keep the source file unchanged while you investigate.
The file is missing from the picker or will not load: Confirm the path, check that the file is not still downloading or open in a program that is writing to it, and make sure it is a plain-text file rather than a renamed document. If the file is unusually large, import only what you need or use Power Query to filter rows before loading. Excel worksheets have a maximum of 1,048,576 rows, so a text file with more records cannot fit on one sheet.
Frequently Asked Questions
Can I open a TXT file in Excel by double-clicking it?
You can try, but Windows may open it in Notepad or another text editor. Even when Excel opens it, you may not get a useful chance to control the delimiter or data types. Data > From Text/CSV is the more reliable route when the layout matters.
Will opening a TXT file change the original file?
Importing it into Excel does not normally change the source TXT. Save the imported result as an XLSX workbook to keep spreadsheet features. Avoid editing and saving over the source if you need to preserve the original plain-text data.
How do I open a tab-delimited TXT file?
Choose Data > From Text/CSV, select the file, and set Delimiter to Tab in the preview. Check that each tab-separated field appears in a separate column, then load the data.
Why are dates or numbers displayed differently after import?
Excel may automatically recognize text as dates or numbers and display it using a format different from the source. Use Transform Data to choose the column type before loading. For values that must remain exactly as written, choose Text.
Can I import a fixed-width TXT file?
Yes. On Windows, enable the legacy text import wizard using File > Options > Data, then choose Data > Get Data > Legacy Wizards > From Text (Legacy). Select Fixed width and adjust the break lines in the wizard before completing the import.
Related
- How to Insert a Line Break in Word Without a New Paragraph
- How to Insert a Blank Line Before a Table in Microsoft Word
- How to Open an IQY File in Excel and Load Web Data
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Freeze Panes Greyed Out? Causes and FixesIf Freeze Panes is greyed out in Excel for Microsoft 365 on Windows, first press Enter or Esc…
- Excel Shortcut to Go to the Bottom of a Data ColumnIn Excel for Microsoft 365 on Windows, press Ctrl+Down Arrow to jump to the bottom edge of the…
- Dotted Line in Excel and Word: How to Add OneTo add a dotted line at the bottom of a cell or selected range in Excel, select it,…
- Outlook Signature in Windows: How to Create OneTo create a signature in Outlook for Windows, open the signature settings for your version of Outlook, create…
- Create CD Labels in Microsoft Word: A Practical GuideYes. In Word for Microsoft 365 on Windows, start at Mailings > Labels > Options and choose a…
- Google Sheets Percentage Bar: Make an In-Cell Progress BarTo make a percentage bar in Google Sheets, put your percentage in one cell and use the SPARKLINE…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.