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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sharepoint filter by f...
Power Automate
Answered

Sharepoint filter by file type/extension

(1) ShareShare
ReportReport
Posted on by

Hi,

I'm trying to create a flow to get only some files.

How can I filter by docx, doc, xls, xlsx, ppt, pptx?

Thanks.

Categories:
I have the same question (0)
  • Verified answer
    v-bacao-msft Profile Picture
    on at

    Hi @Anonymous,

     

    You could get all files information first by using Get files(properties only).

    Then use Filter array to filter files, if the file name with the extension ends with the expected file format.

    Use endswith() function to make a decision.

    Formula reference:

     

    @or(endswith(item()?['{FilenameWithExtension}'], '.docx'),endswith(item()?['{FilenameWithExtension}'], '.doc'),endswith(item()?['{FilenameWithExtension}'], '.xls'),endswith(item()?['{FilenameWithExtension}'], '.xlsx'),endswith(item()?['{FilenameWithExtension}'], '.ppt'),endswith(item()?['{FilenameWithExtension}'], '.pptx'))

    Image reference:

    30.PNG

    Please take a try.

     

    Best Regards,

    Barry

  • Community Power Platform Member Profile Picture
    on at

    Barry,

    It works.

    Thank you.

  • Verified answer
    anton-khrit Profile Picture
    197 on at

    Hi!

     

    There is a better and more effecient way to do this. Filtering result array is time consuming for thouthands of documents.

     

    Just use this oData filter under Advanced section of the "Get files" action:

    File_x0020_Type eq 'xls'

     

    You can find example of usage in this article.

     

    This approach is better because it returns only required files.

     

  • Community Power Platform Member Profile Picture
    on at

    @anton-khrit 

    Yes I noticed that takes too long because we have multiple files.

    With your solution, how can I search for xls, doc, ppt in the same filter? It's possible?

  • Verified answer
    anton-khrit-hq Profile Picture
    13 on at

    This should work for you:

    File_x0020_Type eq 'xls' or File_x0020_Type eq 'doc' or File_x0020_Type eq 'ppt'

     

    I didn't test it.

  • Community Power Platform Member Profile Picture
    on at

    @anton-khrit-hq 

    Your solution works perfectly, and is faster.

    Thank you.

     

    How can I run this in a specific folder inside "Shared Documents"?

  • AngelPA Profile Picture
    5 on at

    how you identify that the name of the fild is "File_x0020_Type"?

  • Dawidvh Profile Picture
    1,346 on at

    Hello @AngelPA, This is an internal property name of SharePoint. There are two others as well:

    FileLeafRef = Name of the file
    FileRef = Relative URL path to the file

  • OscarMartinez Profile Picture
    4 on at

    thanks @anton-khrit, this worked like a charm.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard