TXT to CSV converter
Turn a text file into a CSV. The columns are found for you, whether the file uses tabs, pipes or spaces, and it never leaves your browser.
Drop a text file here
TXT, TSV, DAT or CSV, up to 100 MB. It stays on your computer.
- No sign-up
- Nothing uploaded
- Columns found for you
A CSV with the columns where they belong.
Your file stays on your computer
The text is read and the CSV is written in your browser. Nothing is sent to Mammoth or anyone else.
Lined-up reports split into columns
A column starts where every line has a gap of two or more spaces, so a name like Ana Costa stays in one cell.
Tabs, pipes and commas found for you
The separator is picked from the first lines of the file. If it guessed wrong, change it in one click.
How to convert TXT to CSV
The first line gives the column names. Dashed lines and table borders are left out, and each value is trimmed of the spaces that padded it.
- 1
Add your text file
Drop a .txt, .tsv or .dat file on the box, choose one, or paste the text in.
- 2
Check the columns
A preview shows the table. Change how the columns are split if you need to.
- 3
Download
Save the CSV, with commas, semicolons or tabs, or save it as an Excel file.
Other ways to do it
Excel and Python can both turn a text file into a CSV. The difference is how much you set by hand.
Excel's Text Import Wizard
A one-off file on a computer with Excel
- Finds the columns for youNo
- Drops dashed rule linesNo
- Keeps leading zerosPartly
- No software to installNo
Python with pandas
A script that runs every day
- Finds the columns for youPartly
- Drops dashed rule linesNo
- Keeps leading zerosPartly
- No software to installNo
- This page
This converter
A clean CSV in one step
- Finds the columns for youYes
- Drops dashed rule linesYes
- Keeps leading zerosYes
- No software to installYes
How to convert a text file to CSV in Excel or Python
Excel's Text Import Wizard asks you how the file is split, then Save As writes the CSV. In Python, pandas reads a lined-up file with read_fwf.
- 1
In Excel, go to File > Open, set the file type to Text Files, and pick your .txt file. The Text Import Wizard opens.
- 2
Choose Delimited if a tab or other character sits between the values, or Fixed width if the columns are lined up with spaces.
- 3
Set the separator, or click in the preview to place each column break. Set a column with codes like 00071 to Text.
- 4
Select Finish, then go to File > Save As and pick CSV UTF-8 (Comma delimited).
Want a spreadsheet, not a CSV? The TXT to Excel converter writes an .xlsx straight away.
import pandas as pd
df = pd.read_fwf("report.txt", dtype=str)
df = df.drop(index=0) # the ----- line under the header
df.to_csv("report.csv", index=False)For a file lined up with spaces. pandas reads the dashed line as a row, so it is dropped after reading. Skipping it with skiprows instead makes pandas guess the widths again, and in our test that split O'Neill & Co into two columns. For a tab file, use pd.read_csv("report.txt", sep="\t").
Your file stays private
The converter runs inside this page. Your text file is read and turned into a CSV on your computer, and nothing is sent to Mammoth. That makes it safe for exports with customer or payroll data in them.
Once the page has loaded, it works with your internet switched off.
Getting the same export every week?
Mammoth can take it from there. Put each week's CSV in a folder and the rows are added to one table, ready to download as CSV or Excel.
Weekly reports
| Week 43 | Oct 21 | Ana Costa | 129.50 | |
| Week 43 | Oct 23 | Ben Ellis | 48.00 | |
| Week 44 | Oct 28 | Dev Patel | 75.90 | |
| Week 45 | Nov 04 | Chloé Martin | 310.25 | |
| Week 45 | Nov 06 | O'Neill & Co | 1,200.00 |
Illustration. Every new file in the folder is added to the same table.