Updated 2026-11-07
CSV to TXT: What Converting to Plain Text Actually Means
A CSV file is already a text file. That is the whole reason the request is confusing: the conversion is not about the file format, it is about what structure you want to keep.
Quick answer
Decide which of five outputs you want before you touch the file: the same bytes under a .txt name, a tab-delimited text file, a text file with the delimiters removed, a fixed-width file for a legacy system, or a plain readable dump of the values. Only two of those require real work, and three of them break leading zeros and dates if a spreadsheet is involved. RFC 4180 registers CSV as text/csv, which means the columns exist by convention. TXT has no convention at all, so whatever you pick has to be applied to the file itself.
The five things people mean
| What you need | What it produces | How much work |
|---|---|---|
| A file the receiving system will accept by extension | Identical bytes, .txt name | Rename only |
| Columns preserved, commas replaced | Tab-delimited .txt | One export setting |
| One long string per row | Delimiters stripped or joined | A short script or a find-and-replace |
| Fixed character positions per field | Fixed-width text | Needs a layout, then padding |
| Something a person can read | Values with quoting removed | Careful, this loses the structure |
Route 1: rename, and know what you get
Changing the extension changes nothing about the content. A CSV opens in Notepad as a wall of comma-separated lines and it will open the same way as a .txt file. The reason people do this is that some upload forms filter on the extension, or an import job is configured to treat .txt as free-form text.
Two things to watch. Excel still parses a .txt file as a table when it recognises the delimiters, so the protection you were hoping for does not exist on that side. And a system that expects tab-delimited columns will read your comma-separated line as one value, which usually means the file imports successfully and lands everything in the first column.
Route 2: tab-delimited text, the usual real request
Most systems that ask for TXT want tabs between fields. In Excel, Save As offers Text (Tab delimited) (*.txt), which writes a tab between values and quotes any value that itself contains a tab or a line break. Google Sheets does the same through Download then Tab-separated values.
If you would rather keep the columns and swap the character yourself, the delimiter converter does a real parse rather than a find-and-replace, which matters when a value already contains a comma inside quotes. A blind replace on that file adds columns.
Route 3: strip the delimiters
Occasionally the target is a text file with no separators at all: an address block to print, a list of reference codes, one comment per line. Parse first, then join, and choose a separator that cannot appear in the data. A space fails on names with middle initials; a pipe fails less often.
The trap here is doing it with find-and-replace on the raw file. That removes the commas inside quoted values too, so "Acme Ltd, Unit 4" becomes "Acme Ltd Unit 4" with no way to tell the two commas apart afterwards.
Route 4: fixed-width, when an old system demands it
Bank feeds, payroll imports and mainframe handoffs still specify character positions: field one occupies columns 1 to 12, field two 13 to 30, and so on. This is the one conversion that needs a specification before it needs a tool, because padding is a decision. Left-align text and right-align numbers unless the spec says otherwise, and check the total line length against the spec before sending.
Doing it in a few lines of Python
If the file is larger than a spreadsheet handles comfortably, read it as rows and write it out in the shape you want. This keeps values as strings, so leading zeros survive.
import csv
with open("in.csv", newline="", encoding="utf-8") as f, \
open("out.txt", "w", encoding="utf-8", newline="") as g:
rows = csv.reader(f)
for row in rows:
g.write("\t".join(row) + "\r\n")Swap the join target for " " to collapse a row into one line, or pad each field with str.ljust for a fixed-width layout. The quote handling comes free, which is the part that find-and-replace cannot do.
What actually gets damaged in the conversion
Leading zeros. Account numbers, ZIP codes and product codes lose them the moment a spreadsheet decides the column is numeric. The damage happens on import, not on export, so converting again does not fix anything.
Dates. A value like 03/04/2026 is ambiguous, and the spreadsheet may rewrite it to a locale format or to a serial number depending on the machine that opens it. Text output keeps whatever the cell contained, which is not necessarily what the source file contained.
Encoding. UTF-8 covers the accented characters that Windows-1252 cannot. If the receiving system is old, find out which one it expects before converting, and avoid saving with a byte order mark unless the docs ask for it.
Line endings. Excel writes CRLF, most Unix tools write LF. A file that looks correct in a text editor can still show as one long line in an older reader. Write CRLF when the target is a Windows system.
Size. Excel stops at 1,048,576 rows per sheet, so anything larger has to be handled outside a spreadsheet. Splitting it first keeps the job inside a tool that can finish it; the guide to splitting a large CSV covers the options.
A checklist before you send the file
- Open the output in a plain text editor and read three rows, not one.
- Search the file for your delimiter and confirm every hit is a real separator.
- Confirm the account or product code column still has its leading zeros.
- Check a value with an accent renders as a letter, not as a question mark.
- Confirm the receiving system wants LF or CRLF before you send it.
Sources
- IETF, RFC 4180: Common Format and MIME Type for CSV Files (registers
text/csvand defines the delimiter and quoting rules). - Microsoft Support documentation for the Excel Text (Tab delimited) export format and worksheet row limits.
- Python standard library documentation for the
csvmodule (reader and writer behaviour with newline and encoding arguments).
Related reading
Related reading
Format Conversion — other guides that pair well with this one.
- Convert CSV to PDF
- Convert CSV to Excel Without Excel
- CSV vs CSV UTF-8: What the Two Excel Options Actually Write
- Excel Says the File Format and Extension Don't Match. What Now?
Browse all guides in the NoCodeCSV blog.