Convert TXT to Excel: Plain Text to Spreadsheet

Learn how to convert TXT to Excel: the Text Import Wizard for delimited and fixed-width files, free online TXT to XLSX conversion, Power Query, and Python.

Somewhere in your inbox or on a shared drive sits a .txt file full of data that desperately wants to be a spreadsheet — a payroll export from legacy software, a bank statement download, a log file from a web server, or a supplier price list saved as plain text. Learning to convert TXT to Excel properly is one of the highest-leverage office skills you can pick up, because plain text is the one format every system on earth can produce, and Excel’s Text Import Wizard is the universal key that unlocks it. The catch: not all text files are shaped the same. Some separate columns with commas, tabs, or pipes (delimited text); others align columns at fixed character positions with padding (fixed-width text, beloved by mainframes and government systems).

This guide covers both shapes in full. You will learn the fastest route — a free online txt to xlsx conversion in your browser — plus the complete Text Import Wizard workflow for delimited and fixed-width files, a refreshable Power Query method, a Python script for automation, and options for Google Sheets, Mac, and mobile. We will work a realistic payroll example end to end, fix the classic failures (everything in one column, vanishing leading zeros, mangled characters), and share the pro habits that make text imports boring and reliable. Whether you are an HR officer in Toronto processing a payroll export, a shopkeeper in Mumbai reading a distributor’s rate list, or an analyst in Sydney cleaning server logs, the steps are identical.

Plain text document with line glyphs flowing through a conversion arrow into a structured spreadsheet
Plain text is the universal data format — Excel just needs to know its shape.

What Is a TXT File? Delimited vs Fixed-Width Text

A TXT file is plain, unformatted text — no fonts, no colors, no formulas, just characters and line breaks. When it carries tabular data, it uses one of two layouts, and identifying which one you have is the entire battle:

Delimited text

Columns are separated by a delimiter character: commas (CSV), tabs (TSV), pipes (|), or semicolons. Example:

emp_id,name,department,salary
E001,Aarav Sharma,Sales,55000
E002,"Smith, Emily",Support,48000

Note the quoted "Smith, Emily" — the text qualifier (usually a double quote) protects delimiters that appear inside a field. Excel understands qualifiers natively.

Fixed-width text

Each column occupies an exact character span, padded with spaces. It looks aligned in a monospace editor:

emp_id  name            department  salary
E001    Aarav Sharma    Sales       55000
E002    Emily Smith     Support     48000

Here emp_id is always characters 1–7, name is 9–24, and so on. Banks, payroll bureaus, and government agencies love this format because it is unambiguous for machines — but you must tell Excel exactly where each column starts and ends.

How to tell which you have: open the file in Notepad and look at a data row. Visible separator characters between fields means delimited; fields that line up in tidy vertical columns (best viewed in a monospace font) means fixed-width. When in doubt, try delimited first — Excel will show you instantly in the preview whether columns split correctly.
Monospace text rows with glowing delimiter marks splitting through cut lines into spreadsheet columns
Delimited text splits on separator characters; fixed-width splits on positions.

Method 1: Convert TXT to Excel with a Free Online Tool

When the file is straightforward and you need a spreadsheet now, a browser converter skips the wizard entirely:

  1. Open the converter at csvtoexcel.site/ — it auto-detects common delimiters and runs entirely on your device.
  2. Upload the .txt file (or paste its contents). The tool sniffs whether the text is delimited or fixed-width.
  3. Review the preview grid. Check column splits and spot any text-like numbers that need protecting.
  4. Download the .xlsx and verify in Excel or Sheets.

This route is perfect for one-off files. For recurring exports or tricky fixed-width layouts with dozens of columns, the wizard methods below give you more control.

Method 2: The Text Import Wizard for Delimited Files

The Text Import Wizard is Excel’s classic, bulletproof importer. It appears automatically when you open a .txt file the right way.

  1. Open Excel first — do not double-click the file. Go to File → Open → Browse, set the file filter to Text Files or All Files, and select your .txt.
  2. Step 1 — encoding. Set File origin to 65001: Unicode (UTF-8) unless you know the file is something else. Tick “My data has headers” if the first row holds column names.
  3. Step 2 — delimiters. Choose Delimited, click Next, then check the right delimiter: Tab, Semicolon, Comma, Space, or Other (type | for pipe-delimited files). The preview pane shows columns splitting live — this instant feedback is the wizard’s superpower. Set the text qualifier to " if fields are quoted.
  4. Step 3 — column formats. Click each column in the preview and assign its type: Text for IDs, phone numbers, ZIP/PIN codes, and anything with leading zeros; Date with the correct order (DMY for UK/India/Australia, MDY for the US) for date columns; General for the rest. You can also mark columns “Do not import” to skip junk columns.
  5. Click Finish, place the data at A1, and Save As .xlsx.
The step everyone skips (then regrets): step 3’s column formats. Excel’s General format will happily turn employee ID 00123 into 123 and phone number 09876543210 into scientific notation. Thirty seconds of Text-formatting here prevents hours of cleanup later.

Method 3: Fixed-Width Text Walkthrough (Text Import Wizard)

Fixed-width files need the wizard’s other mode. The trick is placing break lines at exactly the right character positions.

  1. Open the file via File → Open as above. In wizard step 2, choose Fixed width instead of Delimited.
  2. The preview shows your data with a ruler across the top. Click on the ruler to create a break line wherever a new column should start. Drag lines to adjust; double-click a line to delete it.
  3. Use the file’s layout spec if you have one — payroll and banking exports usually come with a document stating “positions 1–7: employee ID, 9–24: name…”. Count carefully: being off by one character shifts every value in that column.
  4. Zoom out mentally: scroll through several rows in the preview. Fixed-width files often have ragged final columns or occasional overflow rows — catch them now.
  5. Continue to step 3 (column formats, as in Method 2), Finish, and save as .xlsx.

Getting the spec: if nobody gave you the column positions, derive them — open the file in a monospace editor (VS Code, Notepad++), turn on the column ruler, and note where each field starts. For a one-off file this takes five minutes; for a recurring feed, ask the provider for the layout document — every serious fixed-width producer has one.

Fixed-width plain text block with a measurement ruler and vertical slice guides cutting columns into a spreadsheet
Fixed-width imports live or die by break-line placement.

Method 4: Import TXT Files with Power Query

Power Query (Data → Get Data → From File → From Text/CSV) imports delimited text with a live preview and makes the whole thing refreshable:

  1. Go to Data → Get Data → From File → From Text/CSV and pick your file.
  2. In the preview, set the Delimiter dropdown (Comma, Tab, Semicolon, Pipe, or Custom) and File Origin (65001 UTF-8). The preview re-renders instantly.
  3. Click Transform Data to clean (trim spaces, fix types, filter rows) or Load for a straight import.
  4. For fixed-width files, Power Query has no break-line UI — instead use Split Column → By Number of Characters repeatedly, or handle it in Python (Method 5).

The refresh advantage is real: point the query at a watched folder, and each new export becomes a one-click update. See our Power Query guide for the full editor tour.

Method 5: Convert TXT to Excel with Python

For automation and large files, pandas reads both layouts:

import pandas as pd

# Delimited: any separator works
df = pd.read_csv("export.txt", sep="|", dtype=str, encoding="utf-8")
df.to_excel("export.xlsx", index=False)

# Fixed-width: give column widths (or positions)
widths = [7, 16, 11, 7]
df2 = pd.read_fwf("payroll.txt", widths=widths, dtype=str,
                  encoding="utf-8", skiprows=1)  # skip header row if present
df2.columns = ["emp_id", "name", "department", "salary"]
df2.to_excel("payroll.xlsx", index=False)

dtype=str keeps every column as text on the way in — convert deliberately afterward with pd.to_numeric() or pd.to_datetime(). Batch a folder with glob, schedule with Task Scheduler or cron, and the daily export converts itself. The pattern mirrors our CSV-to-Excel Python guide.

Notepad-style plain text document with line glyphs flowing into a structured blue spreadsheet grid
Scripted conversion turns a daily chore into a scheduled job.

Method 6: Google Sheets, Mac, and Mobile Options

Google Sheets: File → Import → Upload your .txt. Sheets auto-detects delimiters remarkably well; under “Separator type” you can force Tab, Comma, or Custom (type |). For fixed-width, convert first with the online tool, then upload the XLSX. Mac: Excel for Mac has the same Text Import Wizard (File → Open). Apple Numbers opens delimited text directly — then File → Export To → Excel. Mobile: on iPhone/Android, the browser converter is the path of least resistance; our iPhone guide covers the tap-by-tap flow. Without Excel at all: LibreOffice Calc’s text import dialog rivals Excel’s wizard, and it is free — see opening CSVs without Excel for the broader toolkit.

Worked Example: Payroll Export to Spreadsheet

A mid-size company in Leeds receives this fixed-width payroll export every month. The layout spec says: positions 1–6 employee ID, 8–23 name, 25–34 department, 36–43 salary (in pence):

E00123 Aarav Sharma     Sales      00455000
E00124 Emily Smith      Support    00398000
E00125 Priya Nair       Sales      00462000
  1. File → Open the .txt in Excel; wizard step 1: UTF-8, headers off (there is no header row).
  2. Step 2: Fixed width. Click break lines at positions 7, 24, 35 (just before each new field starts).
  3. Step 3: set column 1 to Text (protects the ID), column 4 to Text for now — we will convert pence to pounds with a formula, which avoids any number-format surprises.
  4. Finish at A1. In E1 type salary_gbp; in E2 enter =D2/100 and format as Currency (£). Fill down.
  5. Add headers in row 1 (insert a row first): emp_id, name, department, salary_pence, salary_gbp. Press Ctrl+T to make it a table, then Save As .xlsx.

Result: a clean, auditable payroll table where the raw pence column is preserved alongside the computed pounds — exactly what an auditor wants to see.

Verifying the payroll import

Before you trust any converted payroll file, run this five-point check: (1) row count matches the source file’s data lines; (2) employee IDs are intact with no dropped leading zeros — sort the ID column and eyeball the top and bottom; (3) the salary totals reconcile — sum salary_gbp and compare against the source system’s control total, which payroll exports almost always include; (4) no names contain stray delimiter characters or truncated text, which signal a mis-split row; (5) date and currency formats are consistent down the whole column. This two-minute audit catches the overwhelming majority of import errors, and it is a habit worth building for every text conversion you do, payroll or otherwise.

Plain TXT file document icon converting through an arrow into an Excel workbook icon
One careful import beats ten minutes of manual cleanup.

Troubleshooting Text Import Problems

Everything lands in one column

Wrong delimiter (or wrong mode entirely — a fixed-width file imported as delimited). Re-import and check the preview at step 2; try each delimiter until columns snap apart. If nothing works, you likely have a fixed-width file — switch modes.

Columns split in the wrong places

Stray delimiter characters inside fields (fixed by proper text qualifiers) or break lines off by one position (fixed-width). Inspect the offending row in a text editor.

Gibberish characters (é instead of é)

Encoding mismatch — re-import as UTF-8. If the file came from an old Windows system, try “Windows-1252” / “ANSI” in step 1. Our encoding guide covers the detective work.

Leading zeros vanish

Set the column to Text in step 3 before finishing. Already imported? The zeros are gone — re-import; formatting afterward cannot recover them.

Dates flip day and month

04/05/2026 is April 5 in the US, 4 May in the UK/India/Australia. Set the column to Date with the correct DMY/MDY order in step 3.

Blank rows or shifted rows

Embedded line breaks inside quoted fields, or trailing spaces confusing fixed-width positions. In Power Query, filter out null rows; for fixed-width, verify positions against the spec.

File opens with weird symbols at the start ()

That is a UTF-8 BOM (byte-order mark). Excel usually handles it, but some tools don’t — re-save the file as “UTF-8 without BOM” in Notepad++ or VS Code.

Line endings: the invisible troublemaker

Text files end lines with invisible characters, and Windows (CRLF), Mac/Linux (LF), and ancient Macs (CR) disagree on which. Mixed line endings — common when files are concatenated from multiple systems — can create phantom blank rows or join two rows into one. If your row count is off by a handful, open the file in Notepad++ and use View → Show Symbol → Show End of Line to see the culprits, then Edit → EOL Conversion → Windows Format to normalize. Python’s open() with default universal-newline mode handles mixed endings gracefully, which is one more reason scripted conversion is forgiving.

Report-style files with headers, footers, and page breaks

Mainframe and ERP exports often wrap data in report furniture: title lines, column headers repeated every 60 lines, page numbers, and grand totals at the end. Import the whole thing, then clean: in Power Query, filter out rows where the first column equals the repeated header text, and remove the footer total rows. In the wizard, note the data’s start row in step 1 (“Start import at row:”) to skip title lines, and simply delete footer rows after import. In Python, skiprows/skipfooter handle both ends. The golden rule: never delete the raw file — clean a copy, so you can always re-derive.

Pro Tips for Flawless Text-to-Spreadsheet Conversions

  • Never double-click. Always import via File → Open so the wizard appears.
  • Read the preview at step 2. It shows delimiter problems instantly — trust it.
  • Type text-like columns as Text in step 3. IDs, phones, PINs, SKUs — every time.
  • Keep the layout spec. For fixed-width feeds, the position document is gold — file it with the import.
  • Count rows before and after. Source line count (minus headers) should equal Excel rows; a mismatch means a delimiter or line-break issue.
  • Freeze the header row (View → Freeze Panes) before auditing a large import.
  • Save recurring imports as Power Query. Weekly text drops become one-click refreshes.
  • Archive the original .txt. Re-importing beats re-requesting from a provider.
  • Document the import recipe. A sticky note in the workbook — “pipe-delimited, UTF-8, col A as Text, skip 2 header rows” — turns next month’s import into a two-minute job for anyone, not just you.
Monospace text block with glowing blue delimiters dropping into matching spreadsheet columns
Deliberate, verified imports make text files boring — in the best way.

Wrestling with a fixed-width layout whose spec went missing years ago? join the discussion in our community forum — layout archaeology is a shared hobby there.

Frequently Asked Questions

How do I convert a TXT file to Excel?

Open Excel, go to File → Open, select your .txt file, and use the Text Import Wizard. Choose Delimited for files with separators like commas or tabs, or Fixed width for column-aligned text, set your column types in step 3, and click Finish.

What is the difference between delimited and fixed-width text?

Delimited text separates columns with a character such as a comma, tab, or pipe. Fixed-width text aligns columns at exact character positions with padding spaces. Excel’s Text Import Wizard handles both — you just pick the right mode in step 2.

Can I convert TXT to XLSX online for free?

Yes. A free online txt to xlsx converter turns plain text into an Excel workbook in your browser. For sensitive files, choose a tool that processes everything locally on your device.

Why does my text file open in one column?

Excel didn’t detect the delimiter or column breaks. Re-import with File → Open and the Text Import Wizard, explicitly choosing Delimited with the right delimiter or Fixed width with manually placed break lines.

How do I keep leading zeros when importing text?

In step 3 of the Text Import Wizard, select the column and set its format to Text before clicking Finish. This prevents Excel from converting codes like 00123 into the number 123.

Can Excel open large TXT files?

Excel handles text files up to its worksheet limits of about one million rows. For larger files, use Power Query, split the file first with a text editor, or process it with Python.

CE
csvtoexcel.site team

We build free, private, browser-based file tools. Every guide is written and tested by our editors.