Import a Txt File Into Excel

“import a txt file into excel” comes up constantly, so this page leads with the exact answer, and only then explains the detail. Everything works in Excel on Windows and Mac and maps almost one-to-one to Google Sheets. Copy the answer above and get back to work, or read on to turn a one-off fix into something you never have to look up again.

Exact answer

In Excel: use Data ▸ Get Data ▸ From Text/CSV, check the delimiter and encoding in the preview, then Load — or click Transform Data first to set columns like leading-zero IDs to Text.

Annotated stepsExcel
1

Go to Data ▸ Get Data ▸ From File ▸ From Text/CSV and pick the .txt file.

2

Check the preview: Excel guesses the delimiter — switch between Tab, Comma, and Semicolon until the columns line up.

3

If accented characters look garbled, set File Origin to 65001: Unicode (UTF-8).

4

Click Transform Data and set ID or phone columns to Text in Power Query so leading zeros survive.

5

Click Close & Load to put the data on a sheet; Refresh re-reads the file later.

6

For text already pasted into one column, use Data ▸ Text to Columns and choose Delimited or Fixed width.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

From Text/CSV reads a .txt or .csv file through Power Query: it previews the data, guesses the delimiter (tab, comma, semicolon), lets you pick the encoding, and loads the result as a refreshable query. The legacy Text Import Wizard does the same job with fixed-width support and per-column types, but is hidden until you re-enable it under File ▸ Options ▸ Data. Text already pasted into one column is split with Text to Columns instead. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “import a txt file into excel”. Start on a copy or a tiny sample, keep the affected cells visible, and compare the result with the tool above before you touch the real workbook. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. The point is a data step that keeps your analysis trustworthy, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

orders.txt contains tab-separated lines like 007→Bolt M8→42. Data ▸ Get Data ▸ From Text/CSV detects the tab delimiter and shows three columns; click Transform Data, set the first column's type to Text, then Close & Load — the ID stays 007 instead of collapsing to 7. Exports from databases, loggers, and legacy systems arrive as plain text; a controlled import gets them into rows and columns without losing zeros, dates, or special characters. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.

In Google Sheets

If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. Nothing on this page is behind a login: the tool runs entirely in your browser, the formula is shown in full with one-click copy, and the steps work the same on Windows and Mac. That is the whole promise here — the exact answer, a way to prove it on your own numbers, and just enough context to make it stick. If you take one thing from this page on “import a txt file into excel”, make it the habit rather than the keystrokes: set the problem up with labelled inputs, reference those cells, and let Excel do the recomputing. Bookmark the page for the syntax, but do the example once in a blank sheet and check it against the tool above — five minutes of hands-on practice fixes the method in memory far better than re-reading, and it surfaces the small snags while they are still harmless. After that the technique is genuinely yours: faster than searching for it again, and reliable enough to drop into work that other people depend on.

Common mistakes

  • Loading ID columns as numbers, which strips leading zeros — set the column type to Text first.
  • Accepting the guessed delimiter when the file actually uses semicolons.
  • Garbled umlauts or accents from the wrong encoding — choose 65001: UTF-8 as File Origin.
  • Choosing Fixed width for a delimited file (or the reverse), which shreds the columns.
  • Hunting for the old Text Import Wizard — re-enable it under File ▸ Options ▸ Data ▸ legacy import wizards.

Frequently asked questions

From Text/CSV or the legacy Text Import Wizard?

From Text/CSV is the modern default: live preview, Power Query transforms, refreshable result. The legacy wizard survives under File ▸ Options ▸ Data if you need its exact old behavior.

How do I keep leading zeros when importing?

Click Transform Data in the import dialog and set the column type to Text before loading. Once a zero is dropped by a number conversion, it is gone.

How do I import a text file into Google Sheets?

File ▸ Import ▸ Upload, pick the .txt file, and leave the separator type on "Detect automatically" or choose tab/comma/custom.