How To Clear Excel Filters


#1

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


#2

How about Ctrl+Shift+L


#3

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.


#4

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


#5

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


#6

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.


#7

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.


#8

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.


#9

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


#10

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