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 Automate / Delete all rows in a t...
Power Automate
Unanswered

Delete all rows in a table

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm new to PA/Flow and very confused by this-deleting rows (no conditions, just empty the entire table) seems like a pretty obvious objective. I am trying to delete all rows in a table when a flow is triggered.

 

(Yes, my table is definitely an excel table, not a range! 🙂 )

 

The flow is marked on Power Automate as running successfully (which I believe confirms the flow is running and that there are no apparent errors, so that's good at least) but the table rows aren't deleted. 

 

The flow is triggered when a Sharepoint list is modified. 

The destination is an excel spreadsheet, which must be emptied/have all rows removed when this list is modified. 

 

(I am assuming that in order to delete a row, a condition must be met (ie, there is no way to simply delete rows without performing a logical test).

 

When an item is created or modified (in the specified Sharepoint site address and list name):

 

List rows present in a table: 

Location: Sharepoint name containing Excel file

Library: Sharepoint folder containing Excel file

File: Excel file

Table: Excel table

 

Apply to each VALUE:

Excel column 2 ('ID_Number') is equal to Excel column 2 ('ID_Number').  (Note that I am simply looking for a test that will always evaluate to true, and I see no reason why this wouldn't do so). 

 

If YES:

Delete a Row:

Location: Sharepoint name containing Excel file

Library: Sharepoint folder containing Excel file

File: Excel file

Table: Excel table 

Key column: ID_Number  (I honestly wasn't sure what to put here. I presume that the key column is important when performing logical tests, since it is checked for its value??)

Key value: ID_Number (Again, I am not sure of the relevance of the key value here. Presume this is a value that is tested for, eg greater than/less than?)

 

 

Note: the above test did not work, so just to confirm that the logical test was not evaluating as false, I duplicated the 'YES' code into 'NO':

 

If NO:

Delete a Row:

Location: Sharepoint name containing Excel file

Library: Sharepoint folder containing Excel file

File: Excel file

Table: Excel table

Key column: ID_Number  

Key value: ID_Number 

 

No joy. The flow appears to run without errors, but the table retains all of its values (all rows should be deleted). 

 

Could someone please assist? 

 

Much appreciated-thanks. 

 

Categories:
  • manuelstgomes Profile Picture
    6,643 on at

    Hi @Anonymous 

     

    It looks ok, at least what you wrote.

     

    Are you defining the name of the table, the key column and the key correctly? Probably it runs correctly but, since it can't match the key with the one in Excel, it doesn't delete anything.

     

    Also be careful with types. You may have a String or a Float that, when compared, may be considered different than your value's type in SharePoint.

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    ​
    Cheers
    Manuel

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the response. I think the 'key column' and 'key value' fields are the issue. But if the intention is to remove existing rows regardless of their currently contained value, then how do I go about removing the rows using the 'delete a row' method? Or is there an alternative approach? 

     

    It does not matter whether the row / field is blank, contains 'aaa' or '123' or any other value-I just want to delete the row 🙂

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous if you are still having issues, could you provide screenshots of your flow?

     

    You shouldn't have to run through a condition in order to delete the rows. Your question is asked and answered here  but basically you can use the List Rows Present in a Table as you had, then nest "Delete a row" in an "Apply to each" loop.

     

    Make sure you're using Dynamic Content that matches the value you choose for your key column so that as the "Apply to Each" loops through the rows in your spreadsheet, you're matching the value in the key column to itself (thus always evaluating as "true") and prompting the Flow to delete the row.

     

    It doesn't matter what field you choose as your "key column", but you need to make sure that the "Dynamic Content" that you select for your "key value" is the same field.

     

    See example screenshot below:

    Delete a Row.png

     

    I hope this helps, let me know if you have any questions.

     

    -Kyle

  • greg2k Profile Picture
    9 on at

    I'm using this approach for a scheduled Excel update, but I find one of the slowest steps is deleting the 1000+ rows in a table so I can replace them with new data. Is there a quicker way to empty the table than listing all current rows and then recursively deleting them?

     

    Thanks!

  • dgwilson Profile Picture
    12 on at

    Did you find a way to do this quickly and efficiently.

    I too have about 1000 rows to delete (whole table contents actually)... so I can populate with new contents.

    I'm doing this from Power BI --> Power Automate

    - David

  • J0el Profile Picture
    58 on at

    I would have thought a standard action to clear table should be created.

    I don't suppose there's any update to this?

  • TonyDew Profile Picture
    49 on at

    On your "Apply to each" where you delete the rows, click the "..." and select setting. Turn on Concurrency Control and crank up the Degree of Parallelism. You'll get a tenfold or greater speed boost.

     

    Having said that, I don't know what any downsides would be to using this method. I use it myself and haven't had any issues that I know about.

  • J0el Profile Picture
    58 on at

    The downsides are:

     

    Maximum of 5000 rows

     

    High utilisation of flows, therefore risk of daily limits being reached

     

    Time taken to delete 5,000 rows takes hours, whereas a delete table contents option would mitigate all of the above

  • TonyDew Profile Picture
    49 on at

    Thank you for the clarification! I was sure there must be some downside.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Joel,

     

    Hope you suggested using Delete table in the Transform query using Power Automate since Execute SQL query is not allowed..But if we use it in Transform Query, rows are getting deleted even if we recreate again.. Did u face that problem.It would be grateful if you can suggest.

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 331 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard