How to get files of a specific type from a SharePoint folder using Power Automate

Hello everyone and welcome to my blog. In today’s blog I will discuss on how you can fetch files of specific type from a folder using Power Automate.

This blog will help you if you have any of the following requirements in Power Automate

  1. Fetch the list of files inside a SharePoint folder
  2. Fetch files of specific type from inside a SharePoint folder example – fetch all word or excel files inside a SharePoint folder.
  3. Filter files of specific extension from a SharePoint folder

Through my blog I share interesting tips and discuss on latest releases of Microsoft.NET technologies, Dynamics 365 and Power Platform, SharePoint and Client scripting libraries. Please subscribe to my blog to stay updated.

Let’s get started. I have a folder inside my Shared Documents library in SharePoint. The folder have a few excel files, word files and text documents. Screenshot below for illustration.

My requirement here is to fetch only the excel files from the folder and process them. The first part is obviously to fetch the file list.

To fetch the list of files from the folder, I use the List folder action of SharePoint connector. We need to specify the SharePoint site collection and the folder name.

The output is JSON array of files. Below illustration shows the output of List folder action.

The output is a collection and each item of the collection has a property MediaType. The best way to filter out files of specific type is to use the MediaType property.

Below illustration show how you can filter out excel, word and text files based on the value of MediaType property. Each of these operations use the Filter Array action of the Data Operation connector.

Now you have three different array, each containing files of specific type which you can use for further processing.

Hope this helped. For similar interesting topics on Microsoft.NET and Power platform, you can subscribe to my blog.

Debajit Dutta
Business Solutions MVP