You cannot save a .txt file as a real Excel workbook directly from Notepad or TextEdit, because those programs only write plain text. The working method is to open the .txt file in Excel and then save it in a spreadsheet format: open Excel, choose File > Open, select the .txt file, run through the Text Import Wizard (or the pop-up delimiter prompt in newer versions), then use File > Save As and pick Excel Workbook (*.xlsx). That converts the tab-, comma- or pipe-separated text into proper columns and rows you can sort, filter and format.
There is also a shortcut that avoids Excel entirely: open the .txt file in an editor, save a copy with a .csv extension, then open the .csv in Excel and save it as .xlsx. This works when the file is genuinely comma- or tab-separated, but it fails badly when the text contains stray commas, line breaks inside fields, or unusual encoding. If you only need Excel to read the file once and you do not want to change the original, importing through File > Open is the safer route because Excel previews the columns before anything is committed.
Menu labels vary slightly between Excel for Windows, Excel for Mac, Excel on the web and older perpetual versions, and Microsoft has renamed or streamlined parts of the import experience over time. Where the exact label differs, the steps below describe what to look for rather than only the wording on the current ribbon.
What You'll Need
- A .txt file that contains structured data: rows separated by line breaks, and columns separated by a delimiter such as a comma, tab, semicolon or pipe character.
- Excel for Windows, Excel for Mac, or Excel on the web. Excel on the web has more limited import options than the desktop apps, so for messy files the desktop version is preferable.
- Knowledge of which delimiter your file actually uses. Open the file in a plain text editor first and look: if columns are separated by commas, it is comma-delimited; if by even gaps, it is almost certainly tab-delimited.
- Write access to the folder where you plan to save the .xlsx copy.
Step-by-Step
- Back up the original. Copy the .txt file to a second folder before you touch it. Importing and re-saving can overwrite the source if you are careless with Save As, and the plain-text original is often your only clean copy.
- Inspect the text first. Open the .txt file in Notepad (Windows) or TextEdit (Mac) and check three things: the character between columns, whether every row has the same number of separators, and whether any field contains the delimiter inside quotation marks. Note the decimal separator too, since it matters on European regional settings.
- Open the file in Excel rather than double-clicking it. Launch Excel first, then go to File > Open > Browse, switch the file type dropdown to All Files (or Text Files) and select your .txt file. Opening from inside Excel gives you the import dialog; double-clicking a .txt file usually opens it in a text editor instead, depending on your file associations.
- Choose the delimiter and preview the columns. In the Text Import Wizard, select Delimited on the first screen. On the second screen, tick the delimiter your file uses (Tab, Comma, Semicolon or Space) and check with the data preview at the bottom that columns line up. On newer Windows versions you may instead get a single dialog with a File Origin dropdown, a Delimiter selection and the preview on the same screen.
- Set the data types on the third screen. Select individual columns in the preview and set them to Text if values such as postcodes, phone numbers, account numbers or leading-zero codes must keep their exact form. Left as General, Excel strips leading zeros and converts long digit strings to scientific notation, which silently corrupts IDs.
- Finish the import. Click Finish. The data lands on a worksheet with each record in its own row.
- Tidy up. Delete any header rows you do not want, remove empty helper columns, and confirm the row count matches your source file. If numbers are showing as left-aligned text, select the column and use Data > Text to Columns or multiply by 1 in a helper cell to force numeric conversion.
- Save as a real workbook. Go to File > Save As, choose a location, then set Save as type to Excel Workbook (*.xlsx). Give it a descriptive name and click Save. Do not use Save (Ctrl+S) instead of Save As at this stage, because Excel may offer to keep the file as a text type and prompt you on every save.
- Verify before you delete anything. Close the workbook, reopen the .xlsx and check that dates, currency and text fields survived. Only then discard the .txt original, and even then only if you have a backup.
Common Mistakes
Renaming .txt to .xlsx. Changing the extension does not convert anything. You get a file Excel refuses to open with a format-mismatch warning, because the contents are still plain text. Extensions describe content; they do not change it.
Watching the wrong delimiter disappear. If you pick Tab when the file is comma-separated, every row collapses into a single column full of commas. If you tick every delimiter box, values containing spaces or hyphens break apart. Preview the result before you click Finish, and untick anything you do not need.
Leaving long numbers on General. Product codes, zip codes and phone numbers lose leading zeros or become 1.23E+18. The damage is invisible until you need that identifier back, and converting scientific notation back to an exact number is not always possible.
Saving over the source file. Using File > Save straight after importing, with the file type still set to text, overwrites the original .txt with tabs, formats and any edits. Always use Save As with the .xlsx type first.
Forgetting regional settings. On systems where the decimal comma is standard, Excel may interpret a comma-delimited file differently than expected. If numbers arrive as text, change the delimiter handling or set the file origin correctly during import.
Assuming a text editor writes a valid CSV. Apps such as Excel include a UTF-8 byte-order mark and quote fields containing delimiters; a hand-edited text file often does neither, so fields with commas inside split into extra columns.
Tips
Use tab-delimited text where you can. Tabs very rarely appear inside real data, so a tab-separated .txt imports cleanly far more often than a comma-separated one.
If you do this regularly, record the import as a query rather than repeating the wizard. Data > From Text/CSV in the Get & Transform section lets you load the same file, apply cleaning steps once and refresh later as the text file changes. For one-off jobs the wizard is faster; for recurring reports the query pays for itself.
Name your columns before saving. Excel tolerates duplicate and blank headers less well than you expect, and sorting or filtering on a blank header is confusing.
Keep the .txt file as the system of record if another program generates it. Converted workbooks drift out of date the moment the source text is regenerated.
Use the data preview as a checklist: correct column count, correct number of rows, and correct data type for the first and last few records. Most import failures are visible there before you commit.
If the file is large, save as .xlsx rather than .csv. The old .xls format has a row limit, and .csv offers no column widths, formatting or formulas.
Troubleshooting
If Excel shows everything in one column, the delimiter is wrong. Re-import and try Tab, then Semicolon, then Comma, checking the preview each time.
If a format-mismatch warning appears when opening, the file is not really an Excel workbook. Confirm the extension matches the content, and re-export it properly through Save As in Excel.
If accented characters appear as strange symbols, the encoding was read incorrectly. Re-import and set the File Origin dropdown to the correct encoding, commonly UTF-8 or the Windows-1252 family, then verify that the preview shows the letters properly.
If dates come in as text, or as the wrong date format, set that column to Date during import and confirm the day/month order matches the source. Ambiguous dates like 03/04 can be read either way.
If Excel refuses to save because the file is in use or read-only, close any other copy of the workbook, check the folder permissions, and save to a different folder or with a slightly different name.
If the import is truncated partway, the file may contain characters encoded badly or rows exceeding the sheet's column limits. Open the tail of the .txt in a text editor to see where it breaks, and split very wide files into smaller imports.
If nothing helps, paste the raw text into a blank worksheet in one column, then use Data > Text to Columns and choose Delimited to split it manually. That is often the quickest recovery path for a handful of rows.
Frequently Asked Questions
Can I just rename a .txt file to .xlsx?
No. Excel opens true workbook formats only; a renamed text file triggers a format error. Import it and then Save As .xlsx.
Does this work in Excel on the web?
You can open and save workbooks in the browser, but the import options for raw text files are more limited than in the desktop app. For files that need careful delimiter and data-type handling, use the desktop version first and then upload the .xlsx.
Will my formulas and formatting survive if I save back to .txt?
No. Plain text keeps only the displayed values, and formatting, formulas, charts and multiple sheets are lost. That is why .xlsx should be the destination format, not the source.
How do I keep leading zeros in my codes?
Set those columns to Text in the import step's data preview, or format the column as Text before pasting values in.
What is the difference between importing and just opening the file?
Opening through File > Open runs the import process and lets you choose delimiters and data types. A plain copy-paste pastes everything into a single column unless the source is already a table.
Can I convert several .txt files at once?
Not with the basic wizard, which handles one file per import. For batches, use the From Text/CSV query option and point it at each file, or combine the text files into a single file first.