Data · 25 tools · nothing uploads

Fixed-width text to CSV

Convert fixed-width text to CSV, either by given column widths in characters or by auto-splitting each line on runs of two or more spaces. Every cell is trimmed of leading and trailing whitespace. Runs entirely on your device.

Input

Options

live

Fixed-width text to CSV cuts every line into cells one of two ways: at character positions listed in widths, or, with auto on, wherever two or more spaces run together. Each cell gets its whitespace trimmed regardless of mode. Neither widths nor auto given gets the run refused. A short line yields shorter, sometimes empty, trailing cells.

Questions

What are widths and auto for?

widths is a comma-separated list of column widths in characters; auto instead splits each line wherever it finds two or more consecutive spaces.

What if I give neither?

The tool refuses with a message asking for widths or to turn on auto.

Are cells trimmed?

Yes, every cell has its leading and trailing whitespace trimmed regardless of which mode produced it.

What happens on a short line?

The last columns for that line come back shorter or empty rather than the tool refusing.

What if a width is not a positive whole number?

The whole run is refused with a message naming the rule.

Related Data tools

1→1Reorder / insert CSV columnsReorder (and drop) a CSV's columns by name, and optionally insert one new column with a constant value at a given position. Quote-aware. A record with a quoted field containing a literal newline stays one record.Takes one file1→1Map CSV column namesRename a CSV's header to a new schema ("old=new" pairs), and optionally drop every column that isn't named in the mapping. Column order and data are otherwise untouched. Quote-aware. A record with a quoted field containing a literal newline stays one record.Takes one file1→1Change CSV separatorRe-delimit a CSV (comma, semicolon, tab or pipe), auto-detecting the current separator when not told what it is. Quote-aware. A record with a quoted field containing a literal newline (including in the header) stays one record.Takes one file1→1Transpose CSVSwap a CSV's rows and columns. Column 1 becomes row 1, and so on. A ragged row (fewer cells than the widest row) is padded with empty cells rather than refused. Quote-aware. A record with a quoted field containing a literal newline stays one record, not two.Takes one file1→1Split CSV into partsCut a CSV into several smaller files of N data rows each, repeating the header in every part. Quote-aware: a record with a quoted field containing a literal newline stays one record.Takes one filen→1Merge CSV filesConcatenate several CSVs with the same header into one file, in the order given. Quote-aware. A record with a quoted field containing a literal newline stays one record.Combines the files you drop1→1Remove duplicate CSV rowsStrip repeated rows from a CSV. Compares whole records, not physical lines, so a quoted field containing a newline is one record and stays one record.Takes one file1→1Find incomplete CSV recordsReport every record whose cell count doesn't match the header: too few cells (a truncated record) or too many (an unescaped comma). Read-only: nothing is changed. Quote-aware, so a record with a quoted field containing a literal newline still counts as one record with the right cell count.Takes one file