A team lead asked me for a reset button. Their test list fills up with junk rows every sprint, and they wanted to empty it from the app instead of selecting items page by page in SharePoint.
The formula is one line, but the version most people copy from forums quietly leaves items behind. I found that out the hard way while testing for this post.
In this tutorial, we’ll delete all items in a sharepoint list from power apps with one button, a confirm step and RemoveIf. Then we’ll delete only some items, see why Remove with a copy table is risky, and clear a collection, which is how you delete all records from a table in Power Apps.
Here’s what we’re building: a Delete all items… button that first asks “Delete all 25 items? This cannot be undone.” Only the Yes, delete all button removes every item.

- A gallery that shows the items in the demo list, with an item counter.
- A two-click delete: the first button asks, the second one deletes.
- Extra buttons to delete with a condition, test the risky Remove() way and clear a collection.
Every result below comes from my Service Desk Demo app, tested in Studio Preview on 11/01/2026.
Before You Start
You need permission to edit and delete items in the list. I’d never practice this on a real list, so I made a throwaway list called SPGDemo Cleanup Items on the SPGuides site. If you’re new to connecting lists, our guide to building a canvas app from a SharePoint list covers the basics.
| Column | Type | Notes |
|---|---|---|
| Title | Single line of text | Required (the default column) |
| Hours | Number | Minimum 0, maximum 40 |
The app fills it with sample rows like these:
| ID | Title | Hours |
|---|---|---|
| 1 | Test item 1 | 2 |
| 2 | Test item 2 | 3 |
| 8 | Test item 8 | 1 |
Important: Microsoft’s docs warn that RemoveIf(DataSource, true) removes all records from the data source’s storage and can affect other users. There’s no undo button in the app, so test on a list nobody needs.
Step 1: Create the App and Connect the List
If you already have an app connected to your list, skip to Step 2. Otherwise, here are the clicks from scratch.
1. Go to make.powerapps.com and select Start with design on the Home page.

2. Select Create from blank. That makes a canvas app, where you place every control yourself.

3. Pick Tablet and select Create. Power Apps Studio, the app editor, opens.

4. Select Add data, search for SharePoint and pick the SharePoint connector.

5. Paste your site URL and select Connect.

6. Check your list and select Connect. My app already used Service Requests, so I ran the same Add data steps again and picked SPGDemo Cleanup Items this time.

Now select New screen > Blank. To rename it, select the screen and click its name in the Properties pane. I called mine scrDeleteAll.
Checkpoint: the list appears under Data in the left pane. It’s now a data source, which is just a place the app reads and writes records.
Step 2: Add 25 Test Items With a Button
We need something to delete. Insert a button labeled Add 25 test items, pick OnSelect in the property dropdown left of the fx formula bar, and type this. The Sequence function makes the numbers 1 to 25, and the Power Apps ForAll function turns each one into a record:
Collect('SPGDemo Cleanup Items',
ForAll(Sequence(25),
{Title: "Test item " & Value, Hours: Mod(Value, 8) + 1}
)
)
Collect accepts a whole table, so all 25 records go in with one call. Mod(Value, 8) + 1 gives each item 1 to 8 hours, which we’ll use in the condition later.
Next, add a label for the count and a vertical gallery. Set the label’s Text, the gallery’s Items to 'SPGDemo Cleanup Items', and the gallery label’s Text:
"Items in list: " & CountRows('SPGDemo Cleanup Items')
ThisItem.ID & " " & ThisItem.Title & " (" & ThisItem.Hours & " h)"
Run the app with Play at the top right, or hold Alt and click the button right in the editor. Press Ctrl+S now and then to save.
Checkpoint: “Items in list: 25” shows, and the gallery lists Test item 1 (2 h), Test item 2 (3 h) and so on, as in the first screenshot.
Note: SharePoint never reuses item IDs. My second batch of 25 came in as IDs 26 to 50, the third as 51 to 75.
Step 3: Add the Confirm Step
A delete-everything button should never fire on the first click. I use a variable to show a warning with Yes and Cancel buttons. Our button OnSelect guide explains how behavior formulas run.
- Insert a button labeled 1. Delete all items… and set its OnSelect to
Set(varDaConfirm, true). - Insert a red label with the warning text below.
- Insert two buttons, Yes, delete all and Cancel. Cancel’s OnSelect is
Set(varDaConfirm, false). - Select the label and both buttons, pick Visible and type
varDaConfirm.
Set(varDaConfirm, true)
"Delete all " & CountRows('SPGDemo Cleanup Items') & " items? This cannot be undone."
Set(varDaConfirm, false)
varDaConfirm is a global variable: Set() creates it the first time it runs. Newer apps can also use the Confirm() function for a built-in dialog, but this version works in every canvas app.
Checkpoint: clicking 1. Delete all items… shows “Delete all 25 items? This cannot be undone.” plus Yes and Cancel. Cancel hides them again.
Step 4: Delete All Items With RemoveIf(list, true)
Now the line that does the work. Select Yes, delete all, pick OnSelect and type:
RemoveIf('SPGDemo Cleanup Items', true);
Set(varDaConfirm, false);
Notify("All items deleted", NotificationType.Success)

RemoveIf deletes every record where the condition is true. A plain true is true for every item, so everything goes. The second line hides the confirm controls, and the Power Apps Notify function shows a green banner.
The yellow triangle sits on the confirm label, not the Yes button. That label uses CountRows, which can only count what the app has loaded. I’ll come back to that, because it matters for delegation in Power Apps.
Checkpoint: no warning icon on the Yes button. Save with Ctrl+S before you test.
Test the App
Press Play, click 1. Delete all items…, then Yes, delete all. The green “All items deleted” banner appeared, the gallery went empty and the counter read “Items in list: 0”.

I also checked the list through the SharePoint REST API: the item count was 0. All 25 items were gone from SharePoint, not only from the screen.
Delete Only Some Items (RemoveIf With a Condition)
Same demo list, refilled with 25 items. Most real cleanups only want part of the list, so give RemoveIf a real condition. The 3. Delete items over 4 hours button runs:
RemoveIf('SPGDemo Cleanup Items', Hours > 4)

That left 13 items, all with 1 to 4 hours: IDs 26, 27, 28, 33, 34, 35, 36, 41, 42, 43, 44, 49 and 50. You can add more conditions, separated by commas, and an item is deleted only when all of them are true.
To delete a single item instead, use the trash icon pattern from our post on deleting a SharePoint list item from a Power Apps gallery.
Why Remove(list, copy table) Is the Risky Way
You’ll see this pattern a lot: copy the list into a collection, then pass the collection to Remove(). The 2. Remove(list, copy table) button does exactly that:
ClearCollect(colDaCopy, 'SPGDemo Cleanup Items');
Remove('SPGDemo Cleanup Items', colDaCopy)

With my data row limit at 2,000, it worked: 13 items went to 0. The data row limit is how many rows the app loads when it can’t hand the work to SharePoint. It’s 500 by default, under Settings (gear, bottom left) > General > Data row limit. Our Power Apps data row limit guide explains it in depth.
To see what happens on a list bigger than the limit, I set the limit to 10 and added 25 items. The counter said “Items in list: 10” and the confirm text said “Delete all 10 items?”, while SharePoint really held 25.

At that limit, RemoveIf(list, true) still deleted all 25 items (the REST count was 0), and again with 15 items. Remove with the copy table did not. It deleted only 10 items and left 15.

SharePoint confirmed it. Test item 11 through Test item 25 were still in the list, and the app’s counter still claimed 10.

The reason: ClearCollect can only copy the first rows up to the data row limit, so the collection held 10 records and Remove deleted exactly those. Use RemoveIf for list deletes, and keep collections for the work they’re good at, as in our guide to removing items from a Power Apps collection.
Delete All Records From a Table in Power Apps
In Power Apps, a “table” can be a collection in memory or a real data source like a SharePoint list or a Dataverse table. The function you need depends on which one you have. If collections are new to you, start with Power Apps collections.
On the same screen, Fill colDaTasks (10) creates a 10-row collection, and two buttons empty it in different ways:
ClearCollect(colDaTasks, ForAll(Sequence(10), {Task: "Task " & Value}))
Clear(colDaTasks)
RemoveIf(colDaTasks, true)
Both gave “CountRows(colDaTasks) = 0”, which you can see at the bottom right of the first screenshot. Clear keeps the collection’s columns and is the cleaner choice for collections.
| What you want to empty | Use | Notes |
|---|---|---|
| Collection | Clear(colDaTasks) | Only works on collections |
| Collection | RemoveIf(colDaTasks, true) | Also works; same result |
| SharePoint list | RemoveIf(list, true) | Deletes the real items |
| Dataverse table | RemoveIf(table, true) | Deletes the real rows |
Clear doesn’t work on a SharePoint list or a Dataverse table, because it only operates on collections. For Dataverse specifics, see deleting all records from a Dataverse table.
Troubleshooting
- The counter shows a smaller number than the list holds. CountRows on SharePoint counts what the app loaded. Check the real count in SharePoint before you trust it.
- Only part of the list was deleted. You probably used Remove with a copied collection. Switch to RemoveIf(list, true).
- The gallery still shows deleted items. Another user or a flow changed the list. Add a button with
Refresh('SPGDemo Cleanup Items'), which reloads the data source. More in our Power Apps Refresh function post. - Clear(list) gives an error. Clear only works on collections. Use RemoveIf instead.
Note: I tested with 25 items. For lists over 2,000 items I’d use a scheduled flow, as in deleting all items from a SharePoint list using Power Automate, or PnP PowerShell if you’re an admin.
Where to Take It Next
- Learn every Remove pattern, including RemoveFlags.All, in our Power Apps Remove function guide.
- Add a delete column to a table control with deleting rows in a Power Apps data table.
- Browse more examples in the Power Apps tutorials hub.
A few more Power Apps tutorials that pair well with this one:
Frequently Asked Questions
How do I delete all items in a SharePoint list from Power Apps?
Put RemoveIf(‘Your List’, true) in a button’s OnSelect. The condition true matches every item, so all of them are deleted. Show a confirm step first, because the delete can’t be undone from the app.
How do I delete all records from a table in Power Apps?
For a collection, use Clear(colName) or RemoveIf(colName, true). For a SharePoint list or Dataverse table, use RemoveIf(TableName, true). The Clear and Collect reference notes that Clear only works on collections.
Why did Remove only delete some of my SharePoint items?
If you copied the list into a collection with ClearCollect and passed it to Remove, the copy holds only the first rows up to the data row limit. In my test at a limit of 10, Remove deleted 10 of 25 items.
Does RemoveIf work on lists with more than 2,000 items?
Microsoft says that when a data source doesn’t support RemoveIf delegation, Power Apps retrieves matching records up to 500 or 2,000 or the data page size, then deletes them one by one (Remove and RemoveIf reference). For very large lists, use Power Automate.
Can I undo RemoveIf in Power Apps?
No. There’s no undo in the app, and the delete affects everyone who uses the list. Build a confirm step and test on a throwaway list first.

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.