Skip to content

TXT to Excel Converter

Turn a delimited .txt file into an Excel workbook. The separator is detected, you check the columns in the preview, then download the .xlsx.

Updated

Choose a .txt file or drop it here.txt .tsv .csv · up to 50 MB · opened on your device, not uploaded

How to convert a TXT file to Excel

  1. Select Choose a .txt file, or drop the file onto the box. Files ending in .tsv and .csv are accepted too.
  2. Look at the preview. Each value should be in its own column, with the first line of the file in row 1.
  3. If the file contains codes, phone numbers or IDs, tick Keep every value as text. The preview reloads so you can confirm that the zeros are there.
  4. Select Download Excel (.xlsx).

Try a sample file loads a short tab-separated list with product codes that begin with zeros, which is a good way to see what the text option does.

Which text files convert well

“Text file” covers many layouts. What matters is how the columns are marked.

Layout How columns are marked Result
Tab-delimited A tab character between values Split into columns
Comma-delimited 00101,Desk lamp,24.00 Split into columns
Semicolon-delimited 00101;Desk lamp;24,00 Split into columns
Pipe-delimited A vertical bar between values Split into columns
Fixed width Spaces pad each value to a set width One column per line
Free text, such as notes or a log No columns at all One column per line

Tab-delimited text is the most common. It is what you get from Save As > Text (Tab delimited) in Excel, from many reporting systems, and from copying a block of cells into a text editor.

Numbers, dates and the text option

By default the converter reads values the way a spreadsheet would. 24.00 becomes the number 24, a recognisable date becomes an Excel date, and 00101 becomes the number 101.

With Keep every value as text ticked, nothing is interpreted. Every cell holds the characters from the file.

In the file Default Kept as text
00101 101 00101
4003600012345678 A number, which Excel holds to 15 significant digits 4003600012345678
24.00 24 24.00
1E5 100000 1E5

The option applies to the whole file. If you need text for one column and numbers for the rest, keep everything as text and convert the numeric columns in Excel afterwards, or use the import steps below, which let you choose per column.

Import a text file in Excel

From Text/CSV

  1. Open a blank workbook and go to Data > Get Data > From File > From Text/CSV.
  2. Select the .txt file. Check Delimiter in the preview and change it if the columns are wrong.
  3. Select Transform Data to set a column’s type to Text, then Close & Load.

The Text Import Wizard

Choosing File > Open, setting the file type to Text Files and picking a .txt file starts the older three-step wizard:

  1. Choose Delimited or Fixed width.
  2. Tick the delimiter, or click on the ruler to place column breaks for fixed-width data.
  3. Select each column and set Column data format to General, Text or Date.

The wizard is still the best tool for fixed-width reports from older systems.

Text that is already on a sheet

If the lines were pasted into column A, select the column and use Data > Text to Columns. It runs the same three steps on cells in place.

Import a text file in Google Sheets

Choose File > Import > Upload, pick the file, and set Separator type to Tab, Comma or Custom. Untick Convert text to numbers, dates and formulas to keep values as typed.

Things that go wrong

  • Everything lands in column A. No delimiter was found. Open the file in a text editor and look at what sits between the values.
  • The columns split in the wrong places. The file mixes separators, for instance commas inside tab-delimited text. Wrapping such values in double quotes at the source fixes it.
  • Decimal commas become text or split a column. In a semicolon file with values such as 24,00, the numbers are European style. Set the right locale during an Excel import.
  • Accented letters are garbled. The file was saved in an older Windows or DOS encoding. In Notepad, use File > Save As and set Encoding to UTF-8 with BOM, then convert again.
  • Report headers and page breaks appear as rows. Printed-style reports repeat titles and totals. Remove the leftover empty lines with Remove blank rows.

Limits

  • Files up to 50 MB. An Excel sheet holds at most 1,048,576 rows and 16,384 columns.
  • Fixed-width layouts are not split.
  • The workbook has one sheet of values. A text file has no formatting or formulas to bring across.
  • The preview shows the first 200 rows and 40 columns. The download has all of them.

If the file is a standard comma-separated export, CSV to Excel covers the same ground with CSV-specific advice.

Questions

How do I convert a text file to Excel?

Choose the .txt file above, check that the preview shows the values in separate columns, and select Download Excel (.xlsx). In Excel, the equivalent is Data > Get Data > From File > From Text/CSV.

Which delimiters are recognised?

Tab, comma, semicolon and pipe. The converter works out which one the file uses, so there is nothing to select.

How do I keep leading zeros from a text file?

Tick Keep every value as text before you download. Codes such as 00101 and long account numbers are then stored exactly as they appear in the file.

Can it convert a fixed-width text file?

No. A file whose columns are lined up with spaces has no delimiter to split on. Use the Text Import Wizard in Excel, which has a Fixed width option where you set the column breaks by hand.

Why is all my data in one column?

The file has no tab, comma, semicolon or pipe between values, or it uses a different separator. Convert it anyway, then split the column with Text to columns.

Is the text file uploaded?

No. It is read and converted in your browser and stays on your device.

Related