web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Clearing out my Dataso...
Power Apps
Unanswered

Clearing out my Datasource

(0) ShareShare
ReportReport
Posted on by 122

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?

Categories:
I have the same question (0)
  • Sienna Profile Picture
    1,532 on at

    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

  • JRaasumaa Profile Picture
    1,325 on at

    @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

     

  • hughrmarks Profile Picture
    122 on at

    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.

  • Sienna Profile Picture
    1,532 on at

    @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

  • hughrmarks Profile Picture
    122 on at

    @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.

  • Shanescows Profile Picture
    2,218 Most Valuable Professional on at

    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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard