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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / BadGateway 502 Excel c...
Power Automate
Unanswered

BadGateway 502 Excel connector failing after months of success

(0) ShareShare
ReportReport
Posted on by 152

I have a lot of production Flows that have been running for over a year successfully. They utilize a few scripts between them. Starting on 9/28 they started failing when running the Excel connector. The files themselves range between 500K and 2.5MB. On a single small account, I have one Flow that who's file is 250K and it works perfectly through PA still. Also running the scripts outside power automate but in the cloud Excel version now fails. Opening the file locally in Excel and running the scripts works great.

 

We were unable to run the script. Please try again.\nOffice JS error: Line 158: {\"message\":\"The request failed with status code of 400, error code invalidSessionReCreatable and the following error message: The session specified in the request does not exist or is invalid due to a transient error.\",\"code\":\"invalidSessionReCreatable\",\"type\":\"Table\",\"method\":\"addColumn\",\"line\":79}\r\nclientRequestId: 69a96fa2-9c45-4706-aa3f-c98ca36bafdb",
 
We were unable to run the script. Please try again.\nOffice JS error: Line 76: Table addColumn: The request failed with status code of 400, error code invalidSessionReCreatable and the following error message: The session specified in the request does not exist or is invalid due to a transient error.\r\nclientRequestId: 203b33db-add1-4989-9137-f5bfb0586b02",
 
Any help would be appreciated!!!
Categories:
I have the same question (0)
  • Yutao Huang Profile Picture
    Microsoft Employee on at

    Hi @Bill51106 , sorry to hear you are running into this issue. It might be related to a regression that we are actively investigating on. The problem seems to have something to do with the workbook size.

     

    I'll keep you posted for any progress. Thanks for your patience!

  • Bill51106 Profile Picture
    152 on at

    @Yutao Thank you very much. I appreciate your time.

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    FYI, we have a local repro and the team is actively working on it as the highest priority to locate the root cause and look for a fix/mitigation. Thanks for your patience!

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    @Bill51106 - just wanted to confirm if you happen to be using the range.copyFrom() API in your code. We are now suspecting that API could be the culprit based on our troubleshooting so far.

  • Bill51106 Profile Picture
    152 on at

    @Yutao that is the exact one.

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    I see! While we're working on a fix to the range.copyFrom() API, do you think for now it's possible to work around it using things like range.getValues() then range.setValues() in your code?

  • MarcellSzeles Profile Picture
    10 on at

    Hi @Yutao ,

    We are seeing the very same issue happening with larger (300KB) workbook sizes with the use of 

    (row 25 in question) table.getRange().getColumnCount();
     

     

    {
     "error": {
     "code": 502,
     "source": "flow-apim-europe-002-northeurope-01.azure-apim.net",
     "clientRequestId": "3edec818-b200-4048-94a7-01c9c36ca781",
     "message": "BadGateway",
     "innerError": {
     "message": "We were unable to run the script. Please try again.\nOffice JS error: Line 25: {\"message\":\"The request failed with status code of 400, error code invalidSessionReCreatable and the following error message: The session specified in the request does not exist or is invalid due to a transient error.\",\"code\":\"invalidSessionReCreatable\",\"type\":\"Range\",\"method\":\"copyFrom\",\"line\":19}\r\nclientRequestId: 3edec818-b200-4048-94a7-01c9c36ca781",
     "logs": []
     }
     }
    }

     

  • MarcellSzeles Profile Picture
    10 on at

    Oh yeah, right before this we have a .copyFrom()

    Any expected fix ETA?

     

    Fyi we use this function to remove formulas from sheets. The function fails only on sheets where we have lots of formulas. Regular (even larger) sheets with values only are not failing.

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    To clarify, based on our current investigation, at this moment Range.copyFrom() only has issues when copyType is ExcelScript.RangeCopyType.values. The temporary workaround is to use range.getValues() and range.setValues() plus some batching (e.g., 5,000 rows per batch, with console.log("...") after each batch to flush queued data operations, refer to this for more details and an example).

     

    The other copyTypes (e.g., ExcelScript.RangeCopyType.all, ExcelScript.RangeCopyType.formats, ExcelScript.RangeCopyType.formulas, etc.) should still work as expected.

     

    We have identified the root cause and are now working on a potential fix. Will keep you all posted. Thanks again for your patience.

  • Bill51106 Profile Picture
    152 on at

    @Yutao Thank you!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard