Recently, I was working on a Power Apps application named Expense Claims App. I had a requirement to create a Power Automate flow that filters files in a SharePoint document library containing a specific substring.
For example, if the file name is “Customer Invoice Details.docx”. I wanted to filter based on a substring, i.e, “Invoice”.
I achieved this with the help of the “Filter Array” action in Power Automate.
In this tutorial, I will cover how to filter an array by string values using the Filter Array action in Power Automate.
With this, I will also show you a few more examples, such as:
- Filter Array by String Value using Power Automate
- Filter a SharePoint Files Array by a Substring in Power Automate
- Filter Empty Strings from SharePoint List Items Array using Power Automate Filter Array Action
Filter an Array by String Value using Filter Array Action in Power Automate
Let me give an example of how to filter an array by string values in Power Automate.
Here, I have created an Array of Objects, as placed in the code:
[
{
"invoiceId": "INV-101",
"status": "Paid",
"isOverdue": "false",
"customer": {
"name": "Daniel Craig",
"email": "[email protected]"
}
},
{
"invoiceId": "INV-102",
"status": "Pending",
"isOverdue": "true",
"customer": {
"name": "Sana Ahmed",
"email": "[email protected]"
}
},
{
"invoiceId": "INV-103",
"status": "Overdue",
"isOverdue": "true",
"customer": {
"name": "Thomas Lee",
"email": "[email protected]"
}
}
]Now, I want to filter the array present in the code above based on a string, specifically ‘isOverdue‘, with a value of ‘false‘.
To achieve this, follow the steps below:
- Firstly, create an Instant cloud flow in Power Automate. If you’re a beginner, consider exploring the Power Automate button flow.
- To store the array value, add an “Initialize variable” flow action. Name the variable, set the type as ‘Array’, and put the Value with the Array provided in the code.

- Next, add a ‘Filter Array‘ action to filter the array items with the ‘isOverdue‘ value as ‘false‘. Provide the parameters mentioned.
- From: Take the Initialize variable from the previous step.
- Filter Query: Insert the expression provided in the code below.
@{item()?['isOverdue']} is equal to @{string('false')}
- To view the output from the previous step, take a ‘Compose’ action. Set the input parameters with a dynamic content of ‘Body‘ value coming from the Filter Array action.

- The flow is ready now. Save and test the flow manually. When the flow executes successfully, open and see the compose outputs. Have a look at the reference image, where it displays the Array object that has [isOverdue value: false].

This is how to filter an array based on a string value using the Filter Array action in Power Automate.
Filter SharePoint Files by Substring using Power Automate Filter Array Action
In this example, I took a SharePoint document library named ‘Invoice Documents‘, which contains various types of files such as .pdf, .xlsx, .docx, and more.

Now, let’s see how to use the Filter Array action in Power Automate to retrieve only the files that contain the word ‘Invoice’ in their file names.
Check out the steps below:
- Create a Button flow in Power Automate so that a single button can trigger a click.
- To get the files from the SharePoint document library, add a ‘Get files (properties only)‘ action. Provide Site Address & List Name.

- Then, add a “Filter Array” action to filter the filenames that contain a specific substring. Set the Parameters as shown below.
- From: Take the body/value of a Get files action from the dynamic content.
- Filter Query: Check the table below for the filter query.
| Choose Value | Operator | Choose Value |
|---|---|---|
| @{item()?[‘{Name}’]} | Contains | Invoice |

Now, the filter array action will filter the array based on the given filter query. Filter Array outputs will show all the file properties. To display only the file names from the retrieved output, add the steps below.
- After that, add an ‘Initialize variable‘ action with an empty array, as shown in the screenshot.

- Following that, add an “Apply to each loop” action by selecting an output from the previous steps: Body of Filter Array action.

- To append the file names to the empty array, add the “Append to array” variable action inside the loop. Set the required parameters.
- Name: Select a variable from the drop-down. In my case, it is VarFiles.
- Value: Insert the below code.
{
"File Name": "@{item()?['{Name}']}"
}
- In the final step, take a Compose action to show only the File Names that contain the Invoice substring.
- Inputs: Add the Initialize variable from the dynamic content [VarFiles].

The flow is ready. Save and test it.
Output:
- Open and see the Compose action outputs. Refer to the image below that shows File names that contain the ‘Invoice’ string.

This is how to filter an array of values that contain a specific substring using Power Automate from a SharePoint library.
Check out How to Filter an Array by Date in Power Automate?
Filter Empty Strings from SharePoint List Items using Power Automate [Filter Array Action]
Let me explain this example: filtering an empty string value from an array of SharePoint list items.
This is the SharePoint list, Invoice Tracker, with various types of columns.

In this example, I will filter the SharePoint list items Array where the “Invoice Number” and “Customer Email” columns have empty string values.
Do follow the steps to filter the SharePoint List Items Array:
- For this, I will create a manually triggered flow in Power Automate.
- To retrieve items from a SharePoint list, add a “Get items” action. Set the required parameters, such as Site Address and List Name.

- Following the previous step, take a ‘Filter Array’ action to filter the SharePoint list items with empty strings from the [Invoice Number and Customer Email columns].
- From: Select body/value of the Get items action from the dynamic content.
- Filter Query: Click on Edit in advanced mode -> Insert the expression placed below.
or(empty(item()?['InvoiceNumber']),empty(item()?['CustomerEmail']))
- After that, I will create a table with the filtered SharePoint list items. To do that, add ‘Create HTML table‘ action. Set the parameters.
- From: Select Body of Filter Array from dynamic content.
- Columns: Choose the Custom option.
| Header | Value |
|---|---|
| Item Name | @{item()?[‘Title’]} |
| Invoice Number | @{item()?[‘InvoiceNumber’]} |
| Customer Email | @{item()?[‘CustomerEmail’]} |
| Unit Price | @{item()?[‘UnitPrice’]} |
From the Values mentioned in the above table, replace the SharePoint column name with your list column name.

- In the last step, add a ‘Send an email (V2) ‘ action to send a table with SharePoint list items that contain empty strings. Configure the parameters, such as To, Subject, and Body.

The flow is completed now. Before running the flow, save it by clicking on the Save icon.
Output:

This way, you can filter an array of SharePoint list items by empty strings using Power Automate.
In this tutorial, I explained how to filter an array by string values in Power Automate using three different examples.
I hope you found this article interesting and helpful. You can also suggest your thoughts and comments in the comments section.
Also read other Power Automate Tutorials:
- Power Automate Array Variable
- Reverse Array in Power Automate
- Power Automate Remove Item from Array
- Power Automate Create an Array from SharePoint List Items
- How to Filter an Array by Index in Power Automate?

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.