How to Delete all rows from a SharePoint Online list using Power Automate

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 SharePointto delete all row items from a SharePoint list using REST API.

Delete all rows in a SharePoint list using flow

On Power Automate, create an instant cloud flow that triggers the flow manually.

Delete all rows from a SharePoint list using flow

To retrieve all the items from the SharePoint list use the Get items action. Configure the Site address and List Name.

Delete all rows from a SharePoint list using Power Automate flow
  • 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.
Example to Delete all rows from a SharePoint list using flow
Example to Delete all rows from a SharePoint list using flow

Now click on Save and run the flow manually. Once the flow ran successfully all the items will be deleted from the list.

Delete all rows in a SharePoint list using flow example

Refresh the SharePoint list, and we can see all list items get deleted from SharePoint Employee List.

Delete all rows from SharePoint list using flow

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.

Delete all rows in the SharePoint list using Power Automate
Delete all rows in the SharePoint list using Power Automate
  • 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'
Power Automate apply to each current item id
Power Automate apply to each current item id
  • 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.
Power Automate edlete all rows in the SharePoint list
Power Automate to delete all rows in the SharePoint list
  • 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.
Power Automate edlete all rows in the SharePoint list example
Power Automate delete all rows in the SharePoint list example

Now  Test the flow by selecting the Test -> Run flow option. In the below screenshot, we can see our flow has run successfully.

Power Automate delete all rows in the SharePoint list
Power Automate to delete all rows in the SharePoint list
Power Automate delete all rows in the SharePoint list example
Power Automate delete all rows in the SharePoint list example
  • Now Open the Refresh the SharePoint Online List.
  • Below, all the list items have been deleted from the SharePoint list using Power Automate flow.
Example to delete all rows in the SharePoint list using flow
For example to delete all rows in the SharePoint list using 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:

>