Skip to content

How to reset all filters and show all data using PhpSpreadsheet? #3367

Answered by MarkBaker
modestguy asked this question in Q&A
Discussion options

You must be logged in to vote

Ok! So it's just a standard AutoFilter

You'll need to reset the filter rules for each column before you call showHideRows()

$autoFilter = $dataSheet->getAutoFilter();
foreach($autoFilter->getColumns() as $column) {
    $autoFilter->clearColumn($column->getColumnIndex());
}
$autoFilter->showHideRows();

Then, if you still want to remove the AutoFilter, you can do so

$dataSheet->removeAutoFilter();

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@modestguy
Comment options

Comment options

You must be logged in to vote
1 reply
@modestguy
Comment options

Answer selected by modestguy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants