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

Create and Update Items in Sharepoint List from Excel Online Business

Hi All,

 

I am trying to create items ins Sharepoint List from Excel Online Business (saved in document library).

 

Below are the screenshots. I was able to run the flow. Problem is, when the flow runs, instead of adding only the new rows from excel, it is creating all the rows available in excel repeatedly. Not sure what is the logic i should use to stop the repetition of the items from excel.

 

I want to create new items in the sharepoint list whenever there are new items added in excel online.

 

UpdateSPListfromExcel0.jpgUpdateSPListfromExcel1.jpgUpdateSPListfromExcel2.jpgUpdateSPListfromExcel3.jpg

 

Request some help 😞 on this.

 

 

Thanks

Sasidhar

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi @sasidhar_mudra ,

 

Assuming the Employee ID is a field with a unique value in the Excel table, you can consider using the following method to configure your Flow.

Use Filter Query to filter out items that already have the same Employee ID, and if not, create a new item.

Image reference:

57.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Helper I
Helper I

Hi, 


I think the easiest way is to have a unique field in your excel file (like an ID/name or something like that).

And also to have this unique field marked as unique in your SharePoint list. When your flow will try to add an existing item the unique field property won't let it. This will generate an "error" in your flow because it's trying to add someting that already exists but it will not interfear with the records that don't exist. If I use this method I usually add a compose as an after action that will catch the errors (use it as a run after in case of unsucces).

 

Another way you could do this is to also list the records from the list and compare if an ID from Excel does not exists in your list, add it and so on.

 

Hope this will help you  🙂

 

Delia

 

@Delia_Laudoni ,

 

Thanks. I enforced unique values in SP list and i was able to save the list with same as excel items. As you mentioned, the flow failed when i run it again.

 

Since I am not from the technical backgroud, i would request you to let me what to compose to catch errors and let the flow run successfully.

 

On the alternative, how do i compare ID from excel to SP list?

 

Apologies, if i am asking too much

 

 

Thanks

Sasidhar

Hi, 

 

1. If you use the first approach after the Create item add a new action called Compose and configure it like that:

Capture14.PNGCapture15.PNG

This solution is a bit tricky because the Creat item may fail for various reasons. (like SP connection fails). 

I reccomend to use the second option, it's safer.

 

2. To compare them you could do something like this:

Capture12.PNG

 

In this case, you have 2 foreach loops (one to parse the Excel table and one for the SP list). These verify if the current item form Excel macthes the current item from SharePoint list.

 

If you have large amount of data you should not bring the entire SP list and only the item that interest you using the Filter Query inside Get items:

 

Capture13.PNG

If the item does not exist in your SP list "Get Item" usually respond with an empty array. 

In this case you have to modify the Condition to make it verify if the the item exist or not in the SharePoint list.  You could measure the array length or something like that.

 

Hope this helps you 🙂

 

Delia

 

 

@Delia_Laudoni ,

 

Thanks for the response. I did try your input. However, i do not see the SP list updating. I believe i am missing something here.

 

Screenshots for reference.

 

updatesplistflowsuccess.JPGupdatesplistflowsuccess1.JPG

 

 

Thanks

Sasidhar

Hi, 


You should create the item when the condition is false (when the id from the excel is not found in SP list).

If the IDs are matching means that the item is found in your list therefore the unique rule will not let you added.


Just move the Create item to If no branch and it should work 🙂

 

Thanks,

Delia

 

Hi @sasidhar_mudra ,

 

Assuming the Employee ID is a field with a unique value in the Excel table, you can consider using the following method to configure your Flow.

Use Filter Query to filter out items that already have the same Employee ID, and if not, create a new item.

Image reference:

57.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@Delia_Laudoni ,

 

Hi Delia,

 

I changed the create item condition to NO. Though the flow ran successfully, the SP list has not been updated after i ran the flow.

 

I tried the other way from other response and it worked for me 🙂

 

I would like to appreciate and thank you for the kind support. I was able to come half way through with the flow because of you.

 

 

Regards

Sasidhar

@v-bacao-msft ,

 

Barry,

 

The solution you provided worked really well for me and sorted the issue i was struggling for two days.

 

Thanks a lot 🙂

 

 

Regards

Sasidhar

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (8,129)