web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / how-to Filter excel wi...
Power Automate
Unanswered

how-to Filter excel with power automate

(0) ShareShare
ReportReport
Posted on by 2

How to filter excel with power automate desktop 

 

Thank you very much.

I have the same question (0)
  • Parthiban759 Profile Picture
    56 on at

    We don't have direction action, two ways 

    1. Through Database connection and through queries get the records to Datatable. Then fill the data into new worksheet.

    2. Using VBA macro code.

  • Gidi Profile Picture
    601 on at

    +automate the steps with UI actions on an Excel window. 

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    With all due respect, automating the Excel UI is a terrible suggestion.

     

    @JamesRPA , if what you want to do is to retrieve filtered data, so you can do some further processing in your flow, you can do that by:

    a) Using a SQL query to Excel. See more info here: https://learn.microsoft.com/en-us/power-automate/desktop-flows/how-to/sql-queries-excel

    b) Reading the entire data from Excel using the normal Excel actions and then looping through the data to add only relevant rows to a new data table you created (much less efficient than a) ).

     

    If you want your Excel file to be filtered (for cases when you don't need the data itself, but maybe need to generate a report or something), the best approach is to use scripting. Use VBscript or PowerShell scripts to open the document, apply AutoFilter to the range you want, set the filter value, save the document and close Excel. This is quite easy to Google or even ask ChatGPT to write for you.

     

    Here's a sample: 

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = False
    
    Set objWorkbook = objExcel.Workbooks.Open("C:\path\to\sample.xlsx") ' Replace with the path to your sample Excel document
    
    Set objWorksheet = objWorkbook.Worksheets(1) ' Sets the first sheet as the active sheet
    
    Set objRange = objWorksheet.UsedRange ' Replace with the range you want to apply the auto filter to by using .Range("A1:D100") instead of .UsedRange for example
    
    objRange.AutoFilter ' Applies auto filter to the range
    
    ' Set a value to filter by on column 1 in the range
    objRange.AutoFilter _
     Field:=1, _
     Criteria1:="FilterValue",
     
    
    objWorkbook.Save ' Saves the document
    
    objWorkbook.Close ' Closes the workbook
    objExcel.Quit ' Quits Excel

     

    See more parameters for the Range.AutoFilter method in VBscript here: https://learn.microsoft.com/en-us/office/vba/api/excel.range.autofilter

     

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution.
    If you like my response, please give it a Thumbs Up.

    If you are interested in Power Automate, you might want to follow me on LinkedIn at https://www.linkedin.com/in/agnius-bartninkas/

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 276 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard