In this Power Automate tutorial, we will discuss, how to delete all rows from a SharePoint Online list using Power Automate. I will also show you, how to delete multiple items filtered by conditions from a SharePoint list using Power Automate.
Delete all rows in a SharePoint list using Power Automate
To delete all existing rows from the SharePoint list using Power Automate, follow the below steps:
In the example, we will use the ‘Send an HTTP request to SharePoint‘ to delete all row items from a SharePoint list using REST API.
On Power Automate, create an instant cloud flow that triggers the flow manually.
To retrieve all the items from the SharePoint list use the Get items action. Configure the Site address and List Name.
- Add an action ‘Send an HTTP request to SharePoint‘ from action triggers and provide the SharePoint site address.
- Method- DELETE
- Uri- _api/web/lists/getbytitle(‘Employee List’)/items(@{items(‘Apply_to_each’)?[‘ID’]})
- Headers-
- content-type – application/json;odata=verbose
- IF-MATCH – *
- X-HTTP-Method – DELETE
- It will automatically perform apply to each action for all the list items presented in the SharePoint list.
Now click on Save and run the flow manually. Once the flow ran successfully all the items will be deleted from the list.
Refresh the SharePoint list, and we can see all list items get deleted from SharePoint Employee List.
This is how to delete all rows in a SharePoint list using Power Automate REST API.
Also, check out, How to get SharePoint list items using Rest API in Microsoft Power Automate
Delete all rows based on filter in a SharePoint list using Power Automate
Follow the steps to delete all rows based on filter condition from a SharePoint list using flow.
In this example, we will delete all the rows in the SharePoint list below, which has the Inactive status.
- Open https://powerautomate.microsoft.com/ and log in with your credentials.
- From the Home page, click +Create -> then Select the instant cloud flow -> select trigger as Manually trigger a flow -> enter the flow name -> click create option.
- 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 Inactive status:
Status eq 'InActive'
- This will get all the items where Status is InActive, Once we get all the list items, we need to iterate over it by using the Apply to each control. Add a new step Search, select Apply to each power, and add it to the flow.
- Pass the dynamic content values which have all the SharePoint list items.
- Then inside Apply to each, click on Add an action. Add a Delete item action from action triggers to delete list items using their IDs. Here provide the Site Address, and List Name, and then in the Id, choose the SharePoint list item ID column like below.
- Click Save to save the flow.
Now Test the flow by selecting the Test -> Run flow option. In the below screenshot, we can see our flow has run successfully.
- Now Open the Refresh the SharePoint Online List.
- Below, all the list items have been deleted from the SharePoint list using Power Automate flow.
This is how to delete all rows in the SharePoint list using Flow based on a filter condition.
Conclusion
Here, we saw 2 easy ways to delete all items from a SharePoint List using Power Automate. In the first approach, we saw, how to do a rest API call in Power Automate to delete all items from a SharePoint list. And also, in the second approach, we have used a filter condition to delete bulk items from a SharePoint Online list.
You may also like the following related tutorials:
- Remove Duplicate items from SharePoint List using Power Automate
- Create SharePoint Online List using Power Automate
- Power Automate Condition If Blank
- Create a SharePoint Online Communication Site using Power Automate
- How to read a text and count its occurrence from a docx file in Power automate?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 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 (9 times). I have also worked in companies like HP, TCS, KPIT, etc.