XLS-SQL logo
XLS-SQL

Filtering recipe

Filter XLSX Rows with SQL

When an Excel filter has grown into a checklist, write the rule once as a WHERE clause and keep it with the report.

The problem

Suppose the sales team asks for North-region orders over 1,000. Doing it once in Excel is simple; remembering the exact clicks next month is the awkward part.

A WHERE clause leaves the rule in plain sight. Run it against the upload, glance over the matches, and export a clean workbook without touching the original.

Try the recipe

  1. 1Upload sales-demo.xlsx with its first row treated as headers.
  2. 2Copy the generated table name into the query.
  3. 3Run the filter and review the selected rows.
  4. 4Download the result as a separate workbook without changing the source file.

Ready-to-use query

Keep North-region orders worth at least 1,000 and sort them by revenue.

Download demo .xlsx
SELECT order_id, order_date, region, product, revenue
FROM tbl_your_session
WHERE region = 'North'
  AND revenue >= 1000
ORDER BY revenue DESC;

Replace tbl_your_session with the table name displayed after upload. The supplied demo is an .xlsx file; XLS-SQL also accepts XLS, CSV, TSV, ODS, JSON, HTML, and Parquet. On the AI page, the block is a prompt for Ask AI.

Filtered XLSX rows in XLS-SQL after running a PostgreSQL WHERE query
Result captured from the local XLS-SQL workflow using synthetic demo data.

Why XLS-SQL fits this job

  • Every condition is visible in one place and can be reviewed later.
  • You see the matching rows before downloading anything.
  • The source workbook stays untouched.
  • AND, OR, IN, LIKE, and NULL checks cover filters that are tedious to rebuild by hand.

Tips & tricks

  • Use parentheses when mixing AND and OR; they make both the logic and your intent unambiguous.
  • Check whether blank spreadsheet cells arrived as NULL or empty text before filtering them.
  • For case-insensitive text matching, try ILIKE instead of LIKE.
  • Keep an ORDER BY in export queries so the downloaded rows arrive in a predictable order.

FAQ

Can I filter XLSX with more than one condition?

Yes. Combine predicates with AND or OR, and use parentheses when the precedence must be explicit.

Will filtering modify my original Excel file?

No. A SELECT returns a new result set, which you can download in any available export format.

Can I clean Excel data with SQL?

SELECT can filter, normalize display values, and build a clean export. Permanent UPDATE operations are intentionally unavailable in public mode.