Remove Duplicate items from SharePoint List using Power Automate

In this Power Automate article, we will see how to remove duplicate items from SharePoint Online List using Power Automate flow.

Recently, I got a requirement to delete duplicate items from a SharePoint Online list using a flow.

Remove duplicate items from a SharePoint list using Power Automate

Let us see how to delete multiple duplicate items from a SharePoint Online list using power automate flow.

We use Power Automate flow, to delete multiple duplicate items in a SharePoint. Because we can choose the manual approach to delete multiple items, there are chances to delete a unique item without noticing the list item.

So in the following, we will use the below SharePoint list which has a repeated list of items (highlighted in red). By using the Power Automate flow we will remove those duplicate items.

remove duplicate items in SharePoint list Using the Power Automate

Our entire flow looks like the below:

remove duplicate items in a SharePoint list

Here, we will create a flow that trigger manually, follow the below steps:

Step:1

Log into Power Automate, select the instant cloud flow -> select trigger as Manually trigger a flow -> enter the flow name -> click create option.

remove duplicate items in a SharePoint list Using Power Automate

Step:2

  • select the +new step and add the Get items to trigger action from the action triggers.
  • Configure the SharePoint site address and list name. In the Filter Query, add the below expression to filter the employee’s active status:
Status eq 'Active'
Example of Power Automate apply to each current item

Step:3

  • Now add a +new step and select data operation, to get the filtered values from SharePoint to get items action.
  • In the from field, pass the dynamic content of values and add the key-value pair, where the key is the Title key, and for the value pass the dynamic content value as shown below:
remove duplicate items in SharePoint Online list using flow

Step:4

To remove the duplicate values and keep only the unique list items, we can use the Union function. Add a compose action and pass the below expression as input which finds the duplicate values and stores only the unique values from the list.

union(body('Select'),body('Select'))
Example to remove duplicate items in SharePoint list Using Power Automate

Step:5

  • Now Add a apply to each action and pass the Output of the compose action.
  • Select +New step and add Filter array action. From the field pass the values of the SharePoint list and check the Title is equal to the mentioned expression which has the current item value.
items('Apply_to_each')?['Title']
remove duplicate items in SharePoint list example

Step:6

  • In the same way, add an apply to each action and use the Skip function to remove only the duplicate values.
  • The skip expression skips the first item and loops through the rest in another Apply to each action from the filter array outputs.
  • Pass the below expression in apply it to each action output value, here we will pass the parameter value as 1 so it skips the first list value.
skip(body('Filter_array'),1)
Example to remove duplicate items in SharePoint list

Step:7

Now add a Delete item action to delete items using their ID. In the ID pass the below-mentioned expression. Click the ok or Update button.

item()?['ID']
remove duplicate items in SharePoint Online list using the flow

Step:8

Save, Test, and run the flow, our flow has run successfully like below:

delete duplicate items in SharePoint Online list using flow
delete duplicate items in the SharePoint Online list using the flow

When we expand the delete item action, we can see based on the ID it deletes the list item in SharePoint List.

Power Automate SharePoint List Remove Duplicates example
  • Open and Refresh the SharePoint Online list.
  • In the below screenshot, we can see it removes the duplicate values in the SharePoint list using the power automate flow.
SharePoint List Remove Duplicates using flow

This is how to delete multiple duplicate items in a SharePoint Online list using power automate flow.

Conclusion

In this Power Automate article, we saw how to remove duplicate items from a SharePoint Online List using Power Automate or Microsoft flow.

You may like the following Power Automate tutorials:

  • The “Filter Array” action has an error – its result will be all the items collected from the list, since it compares the same values (both are the Title value from “Get items” action).
    The expression on the right should be items(‘Apply_to_each’)?[‘Title’]

  • Thanks Valex – spent a whole day troubleshooting, before I scrolled down and found your comment. PLEASE UPDATE THE ORIGINAL POST. While this is helpful, this error renders it useless. TLDR the filter array expression on the right should be items(‘Apply_to_each’)?[‘Title’] – NOTE: If you copy paste this the apostrophes ” ‘ ‘ ” may not paste properly and need to be reentered.

  • >