Order files returned by the ‘Get files’ action in Power Automate

“I want to order the output of the Power Automate ‘Get files’ action to build an HTML table. Order by the Sub Folder Name that houses the file, ascending order.”

If you want to order files in Power Automate, the only option you have is to sort them directly in the ‘Get files’ action. Currently it’s not possible to sort them later (but you can vote for the sorting functionality).

In the ‘Get files (properties only)’ there’s a field ‘Order By’. The only question remains: what value it expects? It’s a similar situations as when filtering by file ‘Name’. In this case, when we want to order by a folder, you have to use the internal name for URL path.

FileRef asc
FileRef desc
Power Automate Get files order

Using the filter above, the output of the ‘Get files’ action will return all files sorted by:

  1. Folder level
  2. Alphabetically

You can see an example of the result below. Left column is sorted by FileRef ascending, right column is not sorted = default sorting by file ID.

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Add a Comment

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