cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

Adding new items to list from excel but need to skip items if already exist and match excel row

Hello,

 

In this workflow I am adding plain xlsx file to a SharePoint document library.

Once the file is added, I am using the "Create table" action to add a table to the document.

Then I use a 60 second delay action to allow time for the table to be added.

 

sudosaurus_0-1637838353437.png

Next I use the "List rows present in a table action" with the Filter Query of Title ne '' to stop blank rows from being added to my SharePoint list (futher down). 

sudosaurus_2-1637838451764.png

Next I use the Apply to each action to grab the value from the previous step (List rows present in a table).

I then use the Get items action to bring back the values of items already existing in a SharePoint list.

Next I add another Apply to each action with a Condition where it checks whether the "EmployeeID" column in the SharePoint list matches the data from the EmployeeID column in the excel file.

 

sudosaurus_3-1637838532604.png

If the data matches (If yes) then do nothing and if it doesn't match (If no) then add new content to the SharePoint list.

sudosaurus_4-1637838585180.png

 

I tested this workflow first before addition in the conditional actions to check that data can be populated to the SharePoint list from the Excel file and this worked perfectly.

 

However my next action is to do the conditional checking, however this is not working correctly and is just creating many duplicates in the SharePoint list instead.

 

Any pointers to what I may be doing wrong?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
miguelcas
Microsoft
Microsoft

Hi @sudosaurus 

 

Here is a way to do the filter that you want. Please see the images and instructions to follow how to avoid existing data in the SharePoint list and then creating just the new items. 

 

1. Just using one apply for each, we are going to filter the data in the Get items action 

    

miguelcas_0-1638464075270.png

What I'm doing here is just getting the item that matches with an ID from the List rows in table output, this is to know if an item is already in the SharePoint list. Take a look of the filter query. 

 

2. Then, add a condition were we want to know if the Get items action get a row. If the length of the output equals 0 create the new item. If its not equal to 0 it means that we already have an item in the SharePoint List. 

 

miguelcas_1-1638464740792.png

 

Note: here the expression to get the length 

length(outputs('Get_items')?['body/value'])
 
Let me know if I can help you with something else. 
 
Thank you for using Microsoft Power Platform Communities.
Community Support Team - Miguel Castro.
If this Post helps, then please consider Accept as solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
miguelcas
Microsoft
Microsoft

Hi @sudosaurus 

 

Here is a way to do the filter that you want. Please see the images and instructions to follow how to avoid existing data in the SharePoint list and then creating just the new items. 

 

1. Just using one apply for each, we are going to filter the data in the Get items action 

    

miguelcas_0-1638464075270.png

What I'm doing here is just getting the item that matches with an ID from the List rows in table output, this is to know if an item is already in the SharePoint list. Take a look of the filter query. 

 

2. Then, add a condition were we want to know if the Get items action get a row. If the length of the output equals 0 create the new item. If its not equal to 0 it means that we already have an item in the SharePoint List. 

 

miguelcas_1-1638464740792.png

 

Note: here the expression to get the length 

length(outputs('Get_items')?['body/value'])
 
Let me know if I can help you with something else. 
 
Thank you for using Microsoft Power Platform Communities.
Community Support Team - Miguel Castro.
If this Post helps, then please consider Accept as solution to help the other members find it more quickly.

 

Hi @miguelcas ,

 

Thanks for your response however this doesn't seem to be working for me.

It is failing on the condition action:

sudosaurus_4-1638650062522.png

 

Flow details:

 

 

sudosaurus_0-1638649823771.png

sudosaurus_1-1638649913950.png

sudosaurus_3-1638649998378.png

 

 

sudosaurus
Post Prodigy
Post Prodigy

Hi @miguelcas 

 

Seems to be working now. Played around with the settings and now working correctly! 🙂

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 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,417)