Working with filters - DON-PHAM/EPPlus GitHub Wiki
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();