How to check if Excel exist filters or not

Hi @UiPath_Community

Bot fetching Excel from client site, in this excel I have to check filters Exist or not

Please help

please check sample attachment:

Filter_Exist_Excel.xlsx (9.3 KB)

Thanks
Shaik Muktharvalli

Hi @shaik.muktharvalli1

Use the VB code to get the Excel filtered or not. Create a variable called IsFiltered as boolean datatype.

Check the below steps for your better understanding,
→ Use the Excel Process scope activity inside of it use the Use excel file activity.
→ In the Use excel file activity give the path of the Excel file.
→ Inside Use excel file activity insert the Invoke VBA Activity.
→ Take a Text file and store the below code,

Function IsFiltered() As Boolean
    Dim ws As Worksheet
    Set ws = ActiveSheet
    
    On Error Resume Next
    IsFiltered = ws.AutoFilterMode And ws.FilterMode
    On Error GoTo 0
End Function

→ Give the Path of the Text file in the code file path, give the method name as IsFiltered.
→ Click on Add argument and pass the IsFiltered variable.
→ It gives True if excel sheet is filtered otherwise gives False.

Hope it helps!!

Hi @shaik.muktharvalli1 ,
You can check by read range with 2 options:
1-read range with visible row only - dt1
2-read range all row - dt2
Compare 2 data we can know file filtered or not


Hope it help,

Hi @mkankatala

Can you send sample workflow please

thanks
shaik

it gives false if excel sheet is filtered

please check @mkankatala

thanks
shaik

anyone help on my post please

I have to check filter exist or not in excel

thanks
shaik

Hi @Nguyen_Van_Luong1

Can you send sample workflow please to understand

Thanks
Shaik

Hello

You can deactivate “Visible rows only” on the Excel Read Range-activity.
Take a look on this screenshot (download files below).


ExcelFilter.xaml (8.9 KB)
Filterdata.xlsx (8.5 KB)

Save the Excel-file on your desktop and run the .xaml-file.

Regards,
Soren

You can follow my screen short

Can you send VBA code to find if filtered exist in excel

thanks
shaik

Hi @shaik.muktharvalli1

Can you try the below

New Text Document.txt (488 Bytes)

Output:

Sequence15.xaml (15.2 KB)

Regards,

Thank you :slightly_smiling_face: @lrtetala it’s working fine

Thanks
Shaik

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.