CSV Column Extractor

Extract Columns

An export from your CRM, analytics platform or database often has 30 columns when you only want 3. This tool reads a CSV paste, takes a comma-separated list of 1-based column indexes, and returns a new CSV with only those columns in the order you requested. Header rows and data rows are treated the same, so column 1 in the header is column 1 in every data row.

How to extract columns

  1. 1

    Paste the CSV

    Full file or a snippet. Lines are split on CR, LF or CRLF and each line is parsed with standard CSV rules.

  2. 2

    List the columns to keep

    Use 1-based indexes separated by commas, e.g. `1,3,5`. The output follows that order: you can re-order columns on the fly.

  3. 3

    Run extract

    Each row is rewritten with only the requested cells. Commas inside cells are handled by quoting them automatically.

  4. 4

    Copy or save

    Paste the result into Excel, a database import wizard, or any tool that reads CSV.

How the extractor handles the tricky bits

CSV looks simple until you hit a cell with a comma or a quote in it. The extractor parses each line with RFC 4180-style CSV rules.

Input parsing rules

  • Rows are split on any Unicode line break, so files from Windows, macOS and Linux all work.
  • Quoted cells may contain commas, newlines and escaped quotes ("").
  • Empty trailing rows are dropped.

Output formatting

  • Column order in the output matches the order you type, not the order in the input.
  • A cell containing a comma is re-wrapped in double quotes so downstream parsers read it back correctly.
  • Cells that do not contain commas are emitted as-is to keep the output compact.

Pitfalls to watch for

Scenario What happens
Index beyond last column Empty string is emitted in that position.
Negative or zero index Indexes below 1 are ignored.
Cell contains a quote character Re-quoted on output per RFC 4180 ("") so strict parsers read it back correctly.
Duplicate index, e.g. 1,1,2 Column 1 is emitted twice, useful for spreadsheet key duplication.

For very large files (millions of rows), consider streaming the CSV through a proper library; the tool keeps everything in memory and will slow down beyond a few hundred thousand rows.

Frequently Asked Questions

Indexes, starting at 1 for the leftmost column. To extract by header name, check the header row in your CSV and translate the names into positions.

Yes. The output preserves the order of your index list. 3,1,2 will emit column 3 first, then column 1, then column 2 for every row including the header.

Missing cells are filled with an empty string. This keeps the output rectangular so downstream tools do not break on ragged rows.

Yes. To extract the columns, the CSV is sent to our server, processed, and the result is sent back to your browser. It is not stored and it is not added to the page link.

Related Tools

Tool available in other languages