Data tools

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.

Runs on your device. The file is never uploaded.

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.

Input

Options

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