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

Trouble with flow to delete and update Sharepoint list (and also general questions about flow logic)

I am building a flow that will update a sharepoint list whenever an Excel sheet in Onedrive is edited. The basic concept is that whenever the Excel sheet is updated, the Sharepoint list gets fully deleted and then repopulated with the new Excel data. I have a few questions related to this.

 

First, I have managed to get the flow to delete the Sharepoint List. So everything works up to that point. The Image 1 I have attached shows the next step where I am trying to next get the list repopulated with Excel data. In the image you see an array I created that contains all the Excel data I want to use to populate the SP list. So I'll do apply-to-each, select that array, then do a create-SP-item. Now my first problem is that once I select the first dynamic content for the columns "number" and "words" (as seen in the image), power automate will suddenly add another "apply to each 2" inside the "Apply to each 4". So when I actually run the flow I get a Sharepoint list that has no text, but does have rows. And it comes with twice the rows it should have. Presumably because there is this nested loop with the double "apply to each" commands. Could someone explain why power automate forces this nested "Apply to each"?

 

Secondly, I find the power automate logic confusing. In Image 2 I show what logically makes sense in my head. This is fabricated in a photo editing software, just to show my confusion. It seems like you would want to loop through each item in the Excel array (apply to each 4), and for each item (which I am assuming an item is defined as a row of data) you create an item in the SP list and populate that item with the corresponding Excel item. So the image is what I think it should look like, but you cannot actually do this in power automate. I want to create Sharepoint items and fill them with Excel items. Could someone explain why this doesn't work? When I try to add the Excel dynamic content to the columns, power automate forces me into a nested "apply to each" with an Excel "Value" as the output. It seems like it wants to match the "create item" dynamic content with the "create item" type whether that is Excel or Sharepoint. However, it seems to me what that would be doing is just repopulating the list with itself which would be redundant of course.  

 

Anyway TL;DR I cannot get the flow to repopulate the list with the updated Excel data

 

Image 1 (top), Image 2  (bottom)                                                                   

1.jpg2.JPG

 

1 ACCEPTED SOLUTION

Accepted Solutions

Why would you try to use the rows from SharePoint that you just deleted to try to create new items in SharePoint?  Number and Words should be input from the Excel List Rows, not the SharePoint Get items.



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

View solution in original post

3 REPLIES 3
Pstork1
Dual Super User
Dual Super User

To do what you are describing use the following logic.

1) Delete the items in the SharePoint list

2) Do a list rows on the Excel Table that is the source of the new rows

3) Do an Apply to each on the Values array coming out of #2.  Inside that loop you can now create a new SharePoint item and access the individual values in each row of the Excel array.  (Your loop is trying to loop on the SharePoint rows, which no longer exist or the array you created from Excel.  But then you use the values from the Excel list rows which adds another apply to each because those values are connected to your array. The list rows already creates a value array, so you don't need another.)



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

Hi,

 

Thank you for your response. As you can see I have created a "list rows" command (image 1). However it is the final step in your reply that I am stuck on. In image 2, I don't know what to put in the rows with the red arrows. As you can see in image 3, if I put the Sharepoint dynamic content it forces a nested "apply to each" loop on me, and the result is that the flow creates a bunch of extra blank rows. 

 

Could you kindly assist me with what to put in those two fields?

 

PA 1.JPGPA 3.jpgPA 2.JPG

Why would you try to use the rows from SharePoint that you just deleted to try to create new items in SharePoint?  Number and Words should be input from the Excel List Rows, not the SharePoint Get items.



-------------------------------------------------------------------------
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
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 (3,872)