cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerSoumyo
Frequent Visitor

Flow running too slow || Merging Excel Files and adding merged content to SharePoint List

I am creating a solution for one of our clients where users will be uploading three excel files with a common Customer ID column (which we can use as key column in Power Automate "Get a Row" action) and on clicking a button in PowerApp, a cloud flow will run that will consolidate/merge the three files based on the common Customer ID column and insert the merged data in a SharePoint list.

 

What I Have Done?

I have used "List all records" for first excel file and then used "Apply to Each" on that. Within this loop, I am using "Get Record" from 2nd and 3rd files based on key column value and finally creating a SharePoint list item with these values.

 

The Problem:

The flow is working fine functionally but the problem is that this flow is taking more than 5 mins to run even with just about 100 records and since this is called from PowerApp button, the flow is throwing time out error.

 

Question/Suggestion Needed:

Is there a better way to implement the flow to reduce the execution time? Or is this a limitation in Power Automate, i.e. for this use case, is it a bad design to launch the flow from PowerApp or is this simply not feasible? Or any alternate suggestion to implement this step outside Power Platform to improve performance?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @PowerSoumyo 

 

I've created a solution that queries 3 tables in a single excel sheet as a proof of concept.

 

I then use a single apply to each and apply the item of the values from the first table against two filter arrays where the id's match and capture the key values for each match in a compose action based on the first (expression) element.  I've assumed that each table ID is unique/primary.  I only run this on 5 records mind you, but it took 1-2 seconds.  You could try turning on concurrency for the apply to each.

 

DamoBird365_0-1618074715653.png

DamoBird365_1-1618074734478.png

 

DamoBird365_2-1618074759682.png

 

My compose output is :

DamoBird365_4-1618074852054.png

 

The final compose action is on the compose within the apply to each.  Pieter shows this method on SharePains.

DamoBird365_3-1618074771603.png

 

If you want to see this in action quickly, copy the code below and paste into "New step" -> MyClipboard.

 

{"id":"4c9819a7-b17f-40b1-9234-871f-79066193","brandColor":"#8C3900","connectionReferences":{"shared_excelonlinebusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-47960226-b338-4d03-bbc1-dcfb-43cc2fda"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"DamoBird365Join3ListsEfficiently","operationDefinition":{"type":"Scope","actions":{"List_rows_present_in_a_table":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!BOIVsACSM02nAvrKA5sQqce2eGDhytpJrD6Ky1g1xl_-qoaIOl6yRo2252_HSDPt","file":"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ","table":"{B9BBB08D-9DEE-4D7C-B948-8B2A831D4217}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{},"metadata":{"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ":"/3Tables.xlsx","tableId":"{B9BBB08D-9DEE-4D7C-B948-8B2A831D4217}"}},"List_rows_present_in_a_table_2":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!BOIVsACSM02nAvrKA5sQqce2eGDhytpJrD6Ky1g1xl_-qoaIOl6yRo2252_HSDPt","file":"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ","table":"{F3C0055D-E52A-44B7-9618-C0A825794EB1}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"List_rows_present_in_a_table":["Succeeded"]},"metadata":{"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ":"/3Tables.xlsx","tableId":"{F3C0055D-E52A-44B7-9618-C0A825794EB1}"}},"List_rows_present_in_a_table_3":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!BOIVsACSM02nAvrKA5sQqce2eGDhytpJrD6Ky1g1xl_-qoaIOl6yRo2252_HSDPt","file":"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ","table":"{51229393-78F0-4156-A7A6-219DA494959E}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"List_rows_present_in_a_table_2":["Succeeded"]},"metadata":{"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ":"/3Tables.xlsx","tableId":"{51229393-78F0-4156-A7A6-219DA494959E}"}},"Apply_to_each":{"type":"Foreach","foreach":"@outputs('List_rows_present_in_a_table')?['body/value']","actions":{"FilterArray1Left2":{"type":"Query","inputs":{"from":"@outputs('List_rows_present_in_a_table_2')?['body/value']","where":"@equals(items('Apply_to_each')?['ID'], item()?['ID'])"},"runAfter":{}},"FilterArray1Left3":{"type":"Query","inputs":{"from":"@outputs('List_rows_present_in_a_table_3')?['body/value']","where":"@equals(items('Apply_to_each')?['ID'], item()?['ID'])"},"runAfter":{"FilterArray1Left2":["Succeeded"]}},"NewArray":{"type":"Compose","inputs":{"id":"@item()?['Id']","Forename":"@item()?['Forename']","Surname":"@first(body('FilterArray1Left2'))?['Surname']","Sex":"@first(body('FilterArray1Left3'))?['Sex']","Height":"@first(body('FilterArray1Left3'))?['Height']","Weight":"@first(body('FilterArray1Left3'))?['Weight']"},"runAfter":{"FilterArray1Left3":["Succeeded"]}}},"runAfter":{"List_rows_present_in_a_table_3":["Succeeded"]}},"Compose":{"type":"Compose","inputs":"@outputs('NewArray')","runAfter":{"Apply_to_each":["Succeeded"]}}},"runAfter":{}}}

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

View solution in original post

6 REPLIES 6

Hi @PowerSoumyo 

 

I've created a solution that queries 3 tables in a single excel sheet as a proof of concept.

 

I then use a single apply to each and apply the item of the values from the first table against two filter arrays where the id's match and capture the key values for each match in a compose action based on the first (expression) element.  I've assumed that each table ID is unique/primary.  I only run this on 5 records mind you, but it took 1-2 seconds.  You could try turning on concurrency for the apply to each.

 

DamoBird365_0-1618074715653.png

DamoBird365_1-1618074734478.png

 

DamoBird365_2-1618074759682.png

 

My compose output is :

DamoBird365_4-1618074852054.png

 

The final compose action is on the compose within the apply to each.  Pieter shows this method on SharePains.

DamoBird365_3-1618074771603.png

 

If you want to see this in action quickly, copy the code below and paste into "New step" -> MyClipboard.

 

{"id":"4c9819a7-b17f-40b1-9234-871f-79066193","brandColor":"#8C3900","connectionReferences":{"shared_excelonlinebusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-47960226-b338-4d03-bbc1-dcfb-43cc2fda"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"DamoBird365Join3ListsEfficiently","operationDefinition":{"type":"Scope","actions":{"List_rows_present_in_a_table":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!BOIVsACSM02nAvrKA5sQqce2eGDhytpJrD6Ky1g1xl_-qoaIOl6yRo2252_HSDPt","file":"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ","table":"{B9BBB08D-9DEE-4D7C-B948-8B2A831D4217}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{},"metadata":{"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ":"/3Tables.xlsx","tableId":"{B9BBB08D-9DEE-4D7C-B948-8B2A831D4217}"}},"List_rows_present_in_a_table_2":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!BOIVsACSM02nAvrKA5sQqce2eGDhytpJrD6Ky1g1xl_-qoaIOl6yRo2252_HSDPt","file":"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ","table":"{F3C0055D-E52A-44B7-9618-C0A825794EB1}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"List_rows_present_in_a_table":["Succeeded"]},"metadata":{"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ":"/3Tables.xlsx","tableId":"{F3C0055D-E52A-44B7-9618-C0A825794EB1}"}},"List_rows_present_in_a_table_3":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!BOIVsACSM02nAvrKA5sQqce2eGDhytpJrD6Ky1g1xl_-qoaIOl6yRo2252_HSDPt","file":"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ","table":"{51229393-78F0-4156-A7A6-219DA494959E}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"List_rows_present_in_a_table_2":["Succeeded"]},"metadata":{"01SRF3RDUV3GZNFNBIVVBK5H7INFDAGMAZ":"/3Tables.xlsx","tableId":"{51229393-78F0-4156-A7A6-219DA494959E}"}},"Apply_to_each":{"type":"Foreach","foreach":"@outputs('List_rows_present_in_a_table')?['body/value']","actions":{"FilterArray1Left2":{"type":"Query","inputs":{"from":"@outputs('List_rows_present_in_a_table_2')?['body/value']","where":"@equals(items('Apply_to_each')?['ID'], item()?['ID'])"},"runAfter":{}},"FilterArray1Left3":{"type":"Query","inputs":{"from":"@outputs('List_rows_present_in_a_table_3')?['body/value']","where":"@equals(items('Apply_to_each')?['ID'], item()?['ID'])"},"runAfter":{"FilterArray1Left2":["Succeeded"]}},"NewArray":{"type":"Compose","inputs":{"id":"@item()?['Id']","Forename":"@item()?['Forename']","Surname":"@first(body('FilterArray1Left2'))?['Surname']","Sex":"@first(body('FilterArray1Left3'))?['Sex']","Height":"@first(body('FilterArray1Left3'))?['Height']","Weight":"@first(body('FilterArray1Left3'))?['Weight']"},"runAfter":{"FilterArray1Left3":["Succeeded"]}}},"runAfter":{"List_rows_present_in_a_table_3":["Succeeded"]}},"Compose":{"type":"Compose","inputs":"@outputs('NewArray')","runAfter":{"Apply_to_each":["Succeeded"]}}},"runAfter":{}}}

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

Hey @PowerSoumyo 

 

How did you get on with this?

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

PowerSoumyo
Frequent Visitor

Hi @DamoBird365

 

Thanks for your response; it is indeed a good solution. I gave it a try this morning and till the Compose new Array step with the JSON output, it is working fine and taking around 30 secs for 100 records which is a significant improvement in performance. I believe the next step would be to parse this JSON output and insert the values in SharePoint list, correct?

Hi @PowerSoumyo 

 

I believe that parsing is a preference if you want to call the fields dynamically.  Otherwise you can build an expression.  Try turning on concurrency on the apply to each - it will currently run that loop in sequence, so I think you have more efficiency to see there.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

PowerSoumyo
Frequent Visitor

Hi @DamoBird365 

 

Turning on Concurrency has brought down the execution time to under 5 seconds (with the default setting of 20 degree of parallelism) which is great. However, I didn't understand the expression part, i.e. how to take the json output from compose new array step and insert to SharePoint list using expression. Can you please elaborate on that or point me to any online resource? Thanks again!

Hi @PowerSoumyo 

 

Superb!  That has to be a great improvement in efficiency.

 

Take a look at https://powerusers.microsoft.com/t5/Building-Flows/How-to-access-JSON-Array-items/td-p/83265

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,814)