1# PHPExcel AutoFilter Reference
2
3
4## Setting an AutoFilter area on a worksheet
5
6To set an autoFilter on a range of cells.
7
8```php
9$objPHPExcel->getActiveSheet()->setAutoFilter('A1:E20');
10```
11
12The first row in an autofilter range will be the heading row, which displays the autoFilter dropdown icons. It is not part of the actual autoFiltered data. All subsequent rows are the autoFiltered data. So an AutoFilter range should always contain the heading row and one or more data rows (one data row is pretty meaningless, but PHPExcel won't actually stop you specifying a meaningless range: it's up to you as the developer to avoid such errors.
13
14If you want to set the whole worksheet as an autofilter region
15
16```php
17$objPHPExcel->getActiveSheet()->setAutoFilter(
18    $objPHPExcel->getActiveSheet()
19        ->calculateWorksheetDimension()
20);
21```
22
23This enables filtering, but does not actually apply any filters.
24
25