Order files returned by the ‘Get files’ action in Power Automate
Posted On November 4, 2020
“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.
Using the filter above, the output of the ‘Get files’ action will return all files sorted by:
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.