Data · 25 tools · nothing uploads

Map CSV column names

Rename 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. Runs entirely on your device.

Input

Options

live

Map CSV column names rewrites the header from comma-separated old=new pairs, writing the result as -mapped.csv. keepUnmapped is on by default, so untouched columns stay in place; turning it off drops every column the mapping leaves out. A name absent from the header stops the run, and two columns can be mapped onto one name.

Questions

How do I write the mapping?

As comma separated old=new pairs, for example "First Name=first_name,E-mail=email". Whitespace around each part is trimmed. Anything without an equals sign is refused with a message naming the offending pair, and a name that does not appear in the header gets "column(s) not found in the header" along with a printout of the real header.

What happens to columns I did not mention?

By default they are kept, in place, under their existing names. Turn keepUnmapped off and every column not named in the mapping is dropped, which turns this tool into a way to select a subset and rename it in one pass. The result text says how many columns were kept out of the original count when you do that.

Does it change the order of my columns or the data?

No. Only the header names change, and only the ones you named. Column order stays exactly as it was and every cell is copied across untouched. If you also need to reorder or insert a column, use Reorder / insert CSV columns.

Can I rename two columns to the same name?

The tool does not stop you, so you would end up with a duplicate header. That is worth avoiding, because tools further down the line reject it: converting such a file with CSV to Parquet is refused by name, since the Arrow based readers cannot open a file with duplicate field names.

Will a value containing a comma or a newline survive?

Yes. The file is parsed with quote state tracked across the whole text, so a quoted cell holding a comma or a literal newline stays a single cell in a single record. The output is re-quoted the same way, so nothing is corrupted on the way out.

What do I get back?

One CSV named after your file with -mapped.csv on the end, plus a line saying how many columns were renamed. Everything happens in your browser, in memory, with no upload. That memory is also the practical size limit, since the whole file and its rewritten copy are held at once.

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→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 file1→1CSV to tableConvert a CSV to markdown, HTML, LaTeX, SQL INSERT statements, JSON, YAML, or Jira table markup. The first row is always the header (object keys for JSON); every format quotes its own special characters.Takes one file