ConvertCSV

How to Filter CSV Data (Rows and Columns)

By Convert CSV Editorial TeamLast updated August 1, 2026

Filter CSV data by column values, ranges, and patterns. Reduce rows before Excel, JSON, or database imports for cleaner results.

What Filtering CSV Data Means

Filtering keeps only the rows (and sometimes columns) that match a rule and drops the rest. It is the fastest way to hand teammates a targeted slice instead of a 200-column dump.

Good filtering is precise. Bad filtering silently deletes rows people expected to see.

Filter shapeExample
Value matchcountry = US
Rangeamount >= 100
Multi-valuestatus IN (Open, Pending)
Pattern matchemail contains @gmail.com
Column selectionkeep only id, email, country

Why Filter Before Sharing or Converting

Smaller, focused CSVs are easier to review, faster to convert, and less likely to leak internal fields.

  • Send an operations team only their region.
  • Give finance only the columns they need.
  • Feed a machine learning script only the fields it uses.
  • Reduce a giant export to something the browser can actually preview.

Step-by-Step: Filter a CSV Correctly

Write the rule down before you delete anything.

  • Keep the original CSV as an immutable backup.
  • Preview in the Online CSV Editor.
  • Confirm delimiter, headers, and encoding.
  • State the filter rule in plain English (US customers with amount over 100).
  • Apply the filter with a script, spreadsheet, or online editor.
  • Compare row counts: before vs after.
  • Spot-check kept and dropped rows.
  • Download the filtered CSV or continue to Excel/JSON conversion.

Python filter example

Keep US customers with amount over 100 USD.

import csv

with open("orders.csv", newline="", encoding="utf-8") as f:
    reader = csv.DictReader(f)
    fields = reader.fieldnames
    kept = [r for r in reader if r["country"] == "US" and int(r["amount"]) > 100]

with open("orders_us_over_100.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.DictWriter(f, fieldnames=fields)
    writer.writeheader()
    writer.writerows(kept)

Spreadsheet filter

Excel and Google Sheets both offer AutoFilter/Filter views. Use them for interactive exploration, then copy the visible rows into a new file or convert to Excel and back to CSV cleanly.

Row Filter vs Column Filter

Say what you mean.

OperationEffect
Row filter (WHERE)Fewer rows, same columns
Column filter (SELECT)Same rows, fewer columns
BothSlice the CSV in two directions

Real-World Examples

Filtering is one of the most common CSV workflows in operations and analytics.

Marketing region carveout

Ops filters a global CRM export by country=UK before handing the file to the UK marketing lead.

Support triage

Support filters status IN (Open, Waiting) so the triage sheet stops competing with resolved tickets.

Class subset

A teaching assistant filters by section to give each TA their own gradebook CSV.

Common Mistakes

Filtering can silently lie if the rule is wrong.

  • Filtering as text when numbers were expected.
  • Missing null/empty handling (country = '' matches nothing you noticed).
  • Trimming/case rules not matching what data teams entered.
  • Overwriting the source file with a filtered version.
  • Filtering after a bad merge without checking sources.

Best Practices

Make filters explicit and repeatable.

  • Write the rule in a comment/README.
  • Log before/after row counts.
  • Normalize case and whitespace only when the business agrees.
  • Verify representative rows.
  • Convert filtered CSVs to Excel or JSON only after preview.

Why Use Convert CSV Online?

Convert CSV Online is free, browser-based, and needs no account for everyday conversions. Preview and pare rows in the Online CSV Editor, then feed the filtered result to CSV to Excel, JSON, or SQL. Client-side processing works on Windows, macOS, and Linux browsers.

Filter and export now

Open the CSV online, keep only the rows and columns you need, and download a focused file for your next step.

Conclusion

Filtering CSV is a discipline: write the rule, verify counts, and export a smaller, safer file. Sharp filters make downstream steps painless.

FAQ

How do I filter rows in a CSV file?

Define the rule, apply it in a spreadsheet, browser editor, or script, then verify row counts before sharing the filtered file.

How do I keep only certain columns in a CSV?

Select just the columns you need and export a slimmer file. Scripts and online editors both support column selection.

Can I filter CSV online?

Yes. Use the Online CSV Editor to preview and reduce rows/columns, then download or convert the filtered file.

Why does my numeric filter miss rows?

The column may be stored as text. Cast values to numbers before comparing (int, float).

Is filtering the same as sorting?

No. Filtering removes rows. Sorting reorders them. You often do both, but they are different operations.

Should I filter before or after conversion?

Filter first when possible. Smaller inputs are faster and safer to convert to Excel, JSON, or SQL.

References

Convert your CSV in the browser

Preview, clean, and convert CSV files free with Convert CSV Online—no installation and no account required for everyday conversions.