Hi,
I would like to compare a Sharepoint list (around 700 items) with an Excel table and delete any items that do not appear in the Excel table. I attempted this by running a 'Get a Row' for every Sharepoint item, but the Get a Row fails when the row is not found. I know that at this point I could continue with a parallel branch that have different 'Configure Run After' settings, but I'd rather the flow didn't fail if possible.
My other attempt is using List All Rows Present In a Table:
The problem with this is obviously how slow it is....around 20 seconds per item... Over 3 hours! I want to follow this up with deleting all rows in the table so I'm looking at one very long flow.
Is there a smarter way of doing this that I'm not seeing?
Thanks for your help!
Joel
Hi @Teresa24486, yes I did, and I have improved it over time. Here is what I do:
1. Use Get Items and List Rows Present in a Table actions to load both the SharePoint list and the Excel table.
2. Use a Select action to select a key column with unique values from the List Rows Present in a Table. E.g. I have a column called "Application ID" with a unique ID for each row.
3. Now we have all the unique values in the Excel table, we will find out which don't appear in the corresponding column in the SharePoint list. Using a Filter Array action, filter the body/value of the Get Items action where the output of the Select action does not contain the value in the key column in the SharePoint list. The output of this Filter Array will be the unique values that do not appear in the excel table.
4. Use an apply to each to cycle through these values and delete the associated item in SharePoint.
It's a little hard to explain, but I hope that helps!
Hi,
Were you able to complete the Delete items from the SharePoint list which are not present in the excel sheet?
I got there in the end! Here is the final flow. It works much faster than the original!
As I'm dealing with numbers, I had some issues with everything going down the 'No' path, even when both columns were formatted as Number and I put the Excel column values into an int(). Putting the Sharepoint values into string() fixed it.
Thanks for all your help @Jcook, I really appreciate it!
Joel
@Anonymous
Sorry, I realized you are passing the append array the full body of the excel.
You will want to have a second loop that loops through excel and appends each row to the array. Right now you are passing in the whole excel in the variable at one time.
Try:
For each loop, pass in the value from excel.
Inside loop append only the Item Name or the identifier which is going to be checked against SharePoint.
Now you will be able to use Contains.
If you need additional help, please send me a sample from excel and I can build a POC.
Hi @Anonymous
Try switching the values around.
Current item contains Array
Thanks @krishnags, I will do this with the new flow.
I'm on attempt 3, which I think is a bit more aligned with what you were suggesting, @Jcook? Only problem is that every line is being picked up by the 'No' path in the condition. Is there a way I can limit the comparison to just the 'Application ID' columns of each the Excel table and the Sharepoint list?
to improve the performance .... and you can try configuring concurent control in "apply to each" to enable parallel opeartions performed. Go to "apply to each" -> Click on three ellipses (...) -> Settings -> Enable Concurrency and drag it to 50.
Thanks @Jcook .
Am I on the right track here? I'm not sure what expression I would use in the Filter Array to compare each Application ID in the Sharepoint list to the Application ID in the array variable :
@Anonymous
Yes, you could list rows in excel than have a loop that appends the information you want to that array/string variable. (Use append)
This would increase performance drastically.
The reason its taking so long right now is that it literally has to list rows in excel for every item in SharePoint.
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2