web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Massive switch stateme...
Power Automate
Answered

Massive switch statement keeps timing out - Excel issue?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I've created a Flow that takes information for a form and populates it in a particular table in an excel spreadsheet. There are 17 worksheets/tables. After creating the Flow, it seems as though the Flow keeps timing out. 

 

I also kept getting a 'bad connection' to the excel connector, and the Flow automatically created a second one. I made a third and so each excel thing is on one of those three. That seemed to fix the fetch error I was getting. I think there were too many things connected to one connector?  

Here is an image of what is within every switch case. Everything seems to work up to the last step of adding a row.

Before that, I am grabbing the latest row from the appropriate table, then getting the index number from that one so that I can provide a new index number for the new form entry, which is the last step there. 

 

Each table has a different index, so I can't do the indexing part earlier than the switch statement. 

alexaRo_0-1594585451260.png

 

Any ideas for making this better? I tried the flow for just one switch statement and it gets to the end and doesn't work. It just says "Bad Gateway".

 

Categories:
I have the same question (0)
  • Verified answer
    v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    Generally, Switch action wouldn't time out. Could you please share the error information about the timeout?

    And please share the configuration of Add a row in a table, how do you use index to extract value from entity to Add row into the Excel?

     

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

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-litu-msft,

     

    The error is "Bad Gateway" and only happens after several minutes of waiting for the Flow to continue. When I watch the Flow while it's in action, green checkmarks appear next to all the steps and then a yellow circle appears next to the final excel and nothing happens. 

     

    Once I initiate some variables, I grab the list of rows from the table that I want. I order them descending and just grab the top one. I also have a query to grab the index. Then I have a parse JSON for the list of values. 

    alexaRo_0-1594642293778.png

     

    Then I set the index variable to the value of the index from the parse JSON. It automatically adds the 'apply to each', but since I'm just grabbing the one item in the list rows, I thought that would be fine. 

     

    Once the index number for the last document is set to the variable I use the formula add(int(variables('indexNo')),1) to input the next index number in the add rows final step. This is the one where I keep getting 'Bad Gateway'. It takes a while for it to finally give up. 

    alexaRo_1-1594642436918.png

     

    Any assistance is greatly appreciated!

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This is what the timeout looks like. I'm still getting it even though I've changed some things around. All of the information that it is showing is correct, I just want it to add it to the table but it won't. I know that it can access this table because that's where it pulls the list of rows from earlier. What am I missing here?

     

    When I wait for it to try to continue the error that is returned is "Bad Gateway".

     

     

    alexaRo_0-1594645456050.png

     

     

  • Verified answer
    v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    Please put this expression into the parse JSON action to test it:

    body('List_rows_present_in_a_table')?['value'][0]

    Annotation 2020-07-14 173538.jpg

     

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard