cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JileMeyn
Regular Visitor

Delete row from Excel if the list item is deleted from SharePoint

Morning All,

 

I was working off another post asking the same info but when I follow how they created the flow for the solution it always triggers as True and doesn't delete the row. If I try and modify the flow it then wants to add an apply all and tried to delete the entire list.

 

The same rows/columns are in the excel sheet and the SharePoint list. But the unique trigger to each row would be 'Question'.

 

https://powerusers.microsoft.com/t5/Power-Automate-User-Groups/Delete-item-from-excel-if-the-list-it...

 

There's the original post I found, any help would be greatly appreciated.

 

Capture.PNG

8 REPLIES 8
Pstork1
Dual Super User
Dual Super User

I think your problem is in the Filter Array action.  You changed the ID to Question, but the right side of the filter is still a String() function, which shouldn't be necessary since Question would already be a string.  Did you change the right side of the filter to point to the Question column?  If not you'll always end up with an empty array.



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

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

I didn't have the option for "Item ID", I tried the other 3 options (value, body, body/value - item) that weren't the names for the rows of the table but each of them did the same thing.

 

In filter array enter: string(triggerOutputs()?['body/ID'])

In condition: empty(body('Filter_array'))

 

Tried using those as well from the original solution and still the same result either deleted all rows, or did nothing.

You have to filter the array by using some value that is both in Excel and SharePoint.  Otherwise you aren't matching the row.  Since you are trying to delete a matching row, what value is in both data sets.  That is what you want to filter on.



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

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

Sorry I am not sure I follow, would you be able to show an example? I thought I tried setting it up based on a unique value for each document "Question" 

You may be able to filter on Question.  But if you are filtering using Question then what is on the right side of the equals?  All I can see in the Screenshot is String().  Since Question is already a String you wouldn't need that formula.  It would be something different.  So I suspect you are trying to compare question to an ID row, which is what the blog had in the right side.  So what is inside your string() function?



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

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

string(triggerOutputs()?['item/Question'])

empty(body('Filter_array'))

First, the question should already be a string so you don't need the String function.  triggerOutputs()?['item/Question'] should be enough.  To troubleshoot use a couple of compose actions just before the filter array to check the values being used on the right and the left side of the filter.  The delete trigger doesn't return all the data of the item that was deleted, so question may not be available in the triggerOutputs.



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

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (4,307)