How To Clear Excel Filters

My process works with excel files.
After opening the excel file, I need to clear any filters that may be applied.
But I can’t find a reliable way to check if filters are applied.

I tried using “Image Exists” activity to look for the following:

  1. the down arrow box next to each column name when filters are on.
    filter%20box

  2. the filter icon from the “Sort & Filter” dropdown
    filter%202

  3. the filter icon from Data tab.
    filter%203

These methods are unreliable and doesn’t always work.

Does anyone have any suggestions?

Thanks,
Ian

How about Ctrl+Shift+L

Yes that is the hotkey to turn filters on/off.
If the file has filters on, then I want to send Ctrl+Shift+L once to turn of filters.
If the file doesn’t have filters on, then I want to leave it alone.

My problem is that I don’t know if the file has filters on or off to begin with.

Hi @in006,

In this case is filter is applied filter icon is highlighted ,if not normal icon will present, so based on that you can take the decision.

Regards,
Arivu

Hi @arivu96,
I’ve tried checking for if the filter icon is highlighted or not, but because the icon doesn’t change, the robot doesn’t always get it right. Sometimes the filter is on but the robot sees it as off, and vice versa.
I was wondering if anyone knew of a more reliable way to check if filter is on/off.

Thank you,
Ian

Lets say filter is not OFF, you send the hot key Shift+Ctrl+L. What happens? Does it impact anything excpet for showing the dropdowns for the columns.

If the filter is ON, when you send Ctrl+Shift+L, the filters are turned off.
If the filter is OFF, when you send Ctrl+Shift+L, Excel will try to turn on filter for whatever cells you have selected at the time.

If you have the header selected with filter on, alt+down will show the Filter options so you can navigate with keystrokes. I wonder if you can do that and look for the Search input box or something to check if Filter is on, cause if it can’t find it then it’s not on.

2 Likes

I will give that a try.
Thanks for everyone’s responses!
-Ian

This method seems to be working consistently.
Thanks for the suggestion