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 Solution
    • 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 to filter files in SharePoint by file name

Posted on February 14, 2021April 14, 2021 by Tom

“I’m trying to filter files in SharePoint by the file name but Power Automate tells me that column ‘Name’ doesn’t exist.”

“Column ‘Name’ does not exist. It may have been deleted by another user.”


When using ‘Get files’ in Power Automate, you get the file ‘Name’ dynamic content as an output, but that doesn’t mean there’s a column called ‘Name’ you could use in the OData Filter Query. As always, it’s not important how the dynamic content is called, but what is behind. And behind the dynamic content ‘Name’ is a value ‘{Name}’.

Power Automate file name internal name

In many situations that would be the column internal name the Filter Query expects, but not here. You can’t use the ‘{Name}’ in the Filter Query as you’d end up with another error message: The $filter expression “{Name} eq ‘xxxx'” is not valid. Creating query failed. To filter by the file name you need a bit of SharePoint background knowledge.

Document library internal names

SharePoint has a set of hidden internal names used on document libraries. They don’t appear in the file properties so it’s hard to find them, but they’ve been in SharePoint since “ancient” versions. The ones I consider most important for filtering in Power Automate are in the table below.

Internal nameDescriptionExample data
FileLeafRefName of file including extensionExampleFile.docx
FileRefServer relative URL path of the filesites/Playground/Shared Documents/20201231/ExampleFile.docx
File_x0020_TypeFile typedocx

Use FileLeafRef instead of Name

As you can see in the table above, file name including extension is hidden behind ‘FileLeafRef’ column. If you use that column in the OData Filter Query you’ll get the file you’re looking for.

FileLeafRef eq 'FileNameWithExtension'

Note: don’t forget the single quotes around the file name. It doesn’t matter if you use dynamic content or typed-in value, it’s needed in both cases.

The example ‘Get files’ action on the screenshot above will return only file test.csv (if it exists). You can use the same column, only with different operator, also to find files with a string in the file name.

Summary

Filtering files from a document library is a rare situation when Power Automate won’t give you a hint. In most situations you can find the internal name in the list/library settings or in the action output. Not so with the default columns in a document libraries. Unless you know the columns internal names, you won’t be able to use the OData Filter Query.

I believe it’s worth filtering directly in the ‘Get files’ action whenever possible, and the 3 internal names from this article should give you all you need.

It is not the only way to find a file, there’s also a solid workaround to get all files and then filter using ‘Filter Query’ action. But then you must get back the dynamic content after the filtering and I prefer to keep my flows simple.


πŸš€ Master Power Automate

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

No spam. Unsubscribe anytime.

7 thoughts on “Power Automate to filter files in SharePoint by file name”

  1. Juan Marcial says:
    November 12, 2021 at 11:34 am

    All of the sudden my query using FileLeafRef does not work correct. After some digging I found out that new files are not found with the condition I set while old fields do. Maybe Microsoft changed the use of this property? Any help would be appreciated.

    Reply
  2. Juan Marcial says:
    November 12, 2021 at 11:41 am

    I think I found the problem. The library has more than 5000 files and it seems SharePoint only consider for the query the first 5000 files !!!!!!! Incredible!!!! I guess I have to find another way to search for the files in a library πŸ™

    Reply
    1. Jirka says:
      May 3, 2022 at 11:44 am

      Hi Juan, I know it’s long time ago πŸ˜‰

      Have you found the solution how to deal with 5000 files limit?

      Have you tried to change Pagination and Treshold in Settings?

      thanks, have a nice day πŸ™‚

      Reply
    2. ennika says:
      July 13, 2022 at 4:25 pm

      thanks, very helpful info! btw as a solution we just moved some of the files into another library. and included Order By Modified desc in our case it could work because we are checking only latest files.

      Reply
  3. Jirka says:
    May 3, 2022 at 11:40 am

    Hey Tom, your blog is just great! I’m happy I’ve found it πŸ™‚

    Reply
  4. Paul says:
    May 5, 2023 at 1:43 pm

    This blog is a life-saver! Can’t thank you enough for breaking this all down for me.

    Reply
  5. Himanshu Punjabi says:
    February 27, 2025 at 10:26 am

    I had the exact same issue. I thought ‘Name’ is available in OData Filter but it was not the case. This article made it so simple to investigate the problem. Thank you so much.

    Reply

Leave a Reply Cancel reply

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

πŸš€ Master Power Automate

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

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Get the Approval Process solution and the Task Delegation App to skip the hard part and deploy an automated, 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