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 / Power Automate Run Scr...
Power Automate
Suggested Answer

Power Automate Run Script returns 502 BadGateway but works in Excel Online

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I am experiencing an issue with the "Run script" action in Power Automate.

The problem started suddenly on 21 July 2026. The flow had been working correctly before, and no relevant changes were made.

 

Environment

 
 
  • Power Automate
  • Excel Online (Business)
  • OneDrive for Business
  • Excel workbook (.xlsx)
  • Office Scripts
 
 

Problem

 

Every "Run script" action fails with the following error:

 

502 BadGateway

x-ms-datasourceerror: True

logs: null

 

Request ID:

 

x-ms-request-id: bd8e1e67-5c53-48be-9cc9-c4733ea1435b

Date: 21 July 2026

 

However, the same Office Script runs successfully when executed directly in Excel Online.

 

What I have already tested

 

To rule out configuration issues, I performed the following tests:

 


  • Created a completely new Excel workbook.


  • Created a new Office Script containing only:



  •  
  •  
 

function main(workbook: ExcelScript.Workbook) {

workbook.getActiveWorksheet().getRange("A1").setValue("Hello");

}

 


  • Created a brand-new Power Automate flow containing only:


    • Manual trigger


    • Run script



    •  
    •  
    Result:

The new flow also fails with the same 502 BadGateway error.

 

Additional troubleshooting

I have also:

 


  • Created a new Excel Online (Business) connection.


  • Deleted the old connection.


  • Confirmed that the same Microsoft 365 account is used in both Excel Online and Power Automate.


  • Verified that the workbook is not open anywhere.


  • Tested with multiple different workbooks and Office Scripts.


  • Confirmed that every script works correctly when executed directly from Excel Online.



  •  
  •  

Why this is critical

 

My production flow generates PDF documents from an Excel template.

The Office Script is used to force Excel to recalculate formulas before the PDF conversion.

Without the script, the generated PDF sometimes contains outdated data or empty calculated fields, although the Excel workbook itself already contains the correct values.

Therefore, the flow cannot be used reliably without the "Run script" action.

 

Additional information

 

Other users are currently reporting the same behavior.

The symptoms are identical:



  • Office Scripts work correctly in Excel Online.


  • The "Run script" action in Power Automate returns 502 BadGateway.


  • The issue affects newly created flows, newly created workbooks, and newly created Office Scripts.



  •  
  •  

This suggests that the issue may not be isolated to my tenant.

 

Question

 

Is there currently a known issue affecting the Excel Online (Business) "Run script" action in Power Automate?

Are there any tenant settings, service incidents, or additional diagnostics that should be checked?

Any help from Microsoft would be greatly appreciated.

 

Thank you.

I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    15,287 Super User 2026 Season 2 on at
    This is a known issue and Microsoft is investigating. It was reported in the admin center on July 20: 6568499 | Power Platform admin center. Not much can be done until Microsoft resolves the problem.
     
    Issue ID 6568499: Power Automate Excel Script Errors
    Description
    Was this helpful?
    Active
    Product: Power Automate
    Created on: 07/20/2026 7:26 AM EDT
    Users are encountering bad gateway errors when running Excel script steps in automation flows. They are seeking solutions to resolve script execution failures in automated processes.
    This issue is being investigated.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 308 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 171 Super User 2026 Season 2

#3
Haque Profile Picture

Haque 137 Super User 2026 Season 2

Last 30 days Overall leaderboard