HandyBench

CSV Column Extractor

Pull specific columns out of CSV or delimited text.

How to use the CSV Column Extractor

  1. 1 Paste your CSV or delimited rows.
  2. 2 Choose the input delimiter (comma, tab, semicolon, pipe or space).
  3. 3 Enter the column number(s) to extract — e.g. 1, 1,3 or 2-4 — and copy the result.

What the extractor parses, and how

The whole text is parsed as delimited records, split on the delimiter you choose: comma, tab, semicolon, pipe or space. The parser follows the quoting convention of RFC 4180: a field wrapped in double quotes may contain the delimiter or a line break, and a doubled quote inside it ("") means one literal quote. Then it takes the columns you listed, counted from 1 (single numbers or ranges such as 2-4), and joins them with the output delimiter. Empty rows are dropped and the order you type is the order you get, so 3,1 swaps two columns.

Worked example

Input with "First row is a header" ticked, columns 1,3, joined with a comma:

name,email,city
Ada Lovelace,[email protected],London
"Smith, John",[email protected],"New York"
Grace Hopper,[email protected]

The header is removed from the output and listed above it as 1=name · 2=email · 3=city. The output is:

Ada Lovelace,London
"Smith, John",New York
Grace Hopper,

Notice the last row: it has only two cells, so column 3 is blank rather than an error. Notice also the second row: the value Smith, John contains the output delimiter, so it is written back with its quotes and stays one value.

Pitfalls and limits

  • Quotes are added only when needed. A value is quoted on output if it contains the output delimiter, a double quote or a line break. Other values are written plain, so the result is not byte-for-byte identical to the input quoting. If you will paste the result somewhere that does not understand quotes, pick a delimiter that never occurs in your data, such as a pipe.
  • Quoted line breaks work. A cell that spans two lines stays in one row. A quote only starts a quoted cell at the start of a cell, so a quote in the middle of a value, such as 55" screen, is literal. A quoted cell that is never closed shows an error asking you to check the quotes.
  • Ranges are supported. 2-4 means columns 2, 3 and 4, and 4-2 gives them in reverse. Anything that is not a positive whole number or a range shows a message asking for valid column numbers.
  • Out-of-range columns come back empty instead of raising an error, which is handy for ragged rows and easy to miss when you mistype a number.
  • Spaces are not trimmed. The Space delimiter splits at every single space, so double spaces create empty cells. Cells keep any padding around commas.
  • Semicolons. Spreadsheet programs in many regions export CSV with semicolons because the comma is the decimal mark there. If everything lands in column 1, change the input delimiter.

Typical next steps are removing repeated values with Remove Duplicate Lines, ordering them with Sort Lines, or quoting each value with Add Prefix and Suffix to Lines. If you need the whole file as structured data rather than one column, the CSV to JSON converter is the tool to reach for.

Examples

  • ▸ Pulling just the email column out of an exported contact list.
  • ▸ Extracting columns 1 and 3 from a tab-separated export.

Frequently asked questions

Does it handle quoted fields that contain commas?

Yes. The parser understands standard double-quote CSV quoting, including doubled quotes and quoted fields that contain line breaks, so a value like "Smith, John" stays in one column and a multi-line notes cell stays in one row. A quote only opens a quoted field at the very start of a field, so an inch mark in the middle of a value, as in 55" screen, is kept as a normal character.

Are values with commas still quoted in the output?

Yes. Quotes are removed while parsing and added back when a value contains the output delimiter, a double quote or a line break, so "Smith, John" stays one value when you join columns with a comma. Values without those characters are written without quotes.

Can I enter a range like 1-3?

Yes. Write 2-4 for columns 2 to 4, or mix ranges and single columns, as in 1,3-5. A backwards range such as 3-1 returns the columns in reverse order. An entry that is not a positive whole number or a range shows a message instead of being ignored, and a column that does not exist in a row comes back empty.

Can I extract more than one column?

Yes. Enter a comma-separated list like 1,3,4 and choose how the selected columns are joined in the output.

How do column numbers work?

Columns are counted from 1 (the first column is 1, not 0). Enable "First row is a header" to skip the header and see the detected column names.