Announcements
I use Patch to drive data into my datasource, which is an Excel table. I pull that data back in to different PowerApps screens. I want to set up a button on one of my screens that clears all of that data out of that table. Any suggestions?
Easiest way is to collect all rows from main datasource into a collection and then use that collection to remove that rows
Put in your button OnSelect property
ClearCollect(RemoveCollection, MainDatasourceName); Remove(ManiDatasourceName,RemoveCollection)
Change the MainDatasourceName with the name of your excel datasource
@hughrmarkswrote:I use Patch to drive data into my datasource, which is an Excel table. I pull that data back in to different PowerApps screens. I want to set up a button on one of my screens that clears all of that data out of that table. Any suggestions?
If you want to clear the excel table you'll need to use a Remove or RemoveIf function
https://docs.microsoft.com/en-us/powerapps/functions/function-remove-removeif
If all you want to do is clear the collected table information in PowerApps, it should be just as easy as doing a Clear(Collection)
If you want to collect fresh info you can do a ClearCollect(Collection, 'DataSource')
See the Clear, Collect, CleaCollect functions here:
https://docs.microsoft.com/en-us/powerapps/functions/function-clear-collect-clearcollect
Well it worked but...... The first column in my table is "ID" numbered 1, 2, 3... I use this to reference the rest of the data. When I cleared out everything it cleared that too - never thought about that. Now I'll have to reset those numbers every time. Can I reference a Row in Excel instead? I won't have to reset my table all that often but I'm hoping there's a way around this.
@hughrmarks
So why are you trying to reset the table then?
You can also reset the table and look for a highest id in a table where your IDs are stored and continue adding new row to the table you reset with highest id+1
@Sienna I pull data from the table to populate some screens. When I want to start over, I need to clear that data. I'm sure it would be much easier to use a collection for this but I'm finding it very difficult to pull specific tems out of a collection. I suppose I should learn more about them. Thank you for your help.
Collection does sound like a better idea. I have a couple videos that may help at least get you closer. PowerApps Collections and More PowerApps Collections.
Maybe instead of troubleshooting this temp table in Excel, which isn't a good idea anyway, let's try troubleshooting your issues with collections. 🙂
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 358 Most Valuable Professional
11manish 214 Super User 2026 Season 2
Mohsin Ali 185