Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Power Automate filter to get only Word (or Excel or PDF…) documents

Posted on August 23, 2020April 14, 2021 by Tom

Do you need to filter only some of the documents in a library using Power Automate? E.g. just Word documents to convert them to PDF?


To use Power Automate to filter a specific documents we need to understand document properties first. Every document uploaded into SharePoint has an internal property FileLeafRef, which is basically the Name of the document including extension, e.g. myDocument.docx. Knowing this, you can use Filter Query in the Get files (properties only) (SharePoint) in the following format:

substringof('.docx', FileLeafRef)

This query will tell the action to return only files where ‘.docx’ string is part of the file name (incl. extension). That means, only Word documents will be filtered.

You can replace the .docx with any other file extension you need. And you can even sort the returned files if needed.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

2 thoughts on “Power Automate filter to get only Word (or Excel or PDF…) documents”

  1. Anita says:
    May 11, 2023 at 7:31 am

    Hello Tom,

    I have used get files( properties only) filter query to get attachments but I can only retrieve one attachment, eg- FileLeafRef eq ‘items(‘Apply_to_each’)?[‘Uniquenumber’]}_1.TXT’ or items(‘Apply_to_each’)?[‘Uniquenumber’]}_1.PDF’
    I want to be able to get all attachments with the unique number whether it is in .txt, .pdf, .doc. When I run the filter query individually for these, it works fine but I am not able to get all the attachments with the unique number (having different document format) to be emailed in the next step. Please help

    Reply
    1. Tom says:
      May 28, 2023 at 3:07 pm

      Hello Anita,
      use the substringof(…) filter as explained in the article instead of the eq.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes