Skip to content

Working with filters

Mats Alm edited this page Nov 10, 2026 · 7 revisions

This page has moved. The current version of this page is at https://epplussoftware.com/docs/formulas-and-filters/working-with-filters/. The EPPlus documentation is no longer updated in this wiki; please use the EPPlus guides and update your bookmarks.

EPPlus 5 supports creating and applying filters, either as an autofilter on the worksheet or as a filter in a table. EPPlus supports the following filters:

  • Value filters
  • Date group filters
  • Custom filters
  • Top 10 filters
  • Dynamic filters

Example

Here is an example of how to add filters to a range ('p' in the code below is an instance of the ExcelPackage class).

var ws = p.Workbook.Worksheets.Add("ValueFilter");
ExcelRangeBase range = await LoadFromDatabase(connectionString, ws);

range.AutoFilter = true;
var colCompany = ws.AutoFilter.Columns.AddValueFilterColumn(0);
colCompany.Filters.Add("Walsh LLC");
colCompany.Filters.Add("Harber-Goldner");
// ApplyFilter() will set the rows that don't match the filters to hidden.
ws.AutoFilter.ApplyFilter();

See also

See Sample 4.2-C# or Sample 4.2-VB

EPPlus wiki

Versions

Worksheet & Ranges

Styling

Import/Export data

Formulas and filters

Charts & Drawing objects

Tables & Pivot Tables

VBA & Protection

Clone this wiki locally