cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Delete all rows in a table

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. 

 

3 REPLIES 3
Highlighted
Super User
Super User

Re: Delete all rows in a table

Hi @MaxDonen 

 

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

Highlighted
Helper V
Helper V

Re: Delete all rows in a table

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 🙂

 

 

Highlighted
Resolver I
Resolver I

Re: Delete all rows in a table

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

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,522)