office-scripts-docs icon indicating copy to clipboard operation
office-scripts-docs copied to clipboard

Office script to refresh all data connections of the workbook not working in PowerAutomate

Open GANESHA1805 opened this issue 9 months ago • 11 comments

Hi experts, I have used the Office script to refresh all data connections of the workbook. The workbook uses the OLEDB connection to the Power BI dataset.

function main(workbook: ExcelScript.Workbook) { workbook.refreshAllDataConnections(); }

But while running this script via Power Automate, I get the following error.

**Error Action 'Run_script' failed

We were unable to run the script. Please try again. Office JS error: Line 2: Workbook refreshAllDataConnections: There was an internal error while processing the request. clientRequestId: f8c5616e-ecb9-4670-9eaf-a7764e754453**

some hints please...

GANESHA1805 avatar May 09 '25 06:05 GANESHA1805

Hi @GANESHA1805,

Thank you for reporting this. It looks like the behavior of that function changed (the existing documentation states that method should either refresh PowerBI sources or silently fail when used in Power Automate). Let me tag @jeremy-msft to investigate.

AlexJerabek avatar May 09 '25 16:05 AlexJerabek

Hi Alex,

Thank you for your response.

I hope you are refering following line in this document: https://learn.microsoft.com/en-us/office/dev/scripts/testing/power-automate-troubleshooting#script-methods-with-a-different-behavior-in-power-automate

refreshAllDataConnections - Only refreshes PowerBI sources. For other sources, the method returns successfully but does nothing.

Since I am also using a PowerBI dataset with the connection type OLEDB, I believe this should be supported.

Regards, Ganesha

GANESHA1805 avatar May 12 '25 10:05 GANESHA1805

Hi @GANESHA1805, thanks for your report and patience. We believe this has been resolved now, but please let us know if you are continuing to see issues.

jeremy-msft avatar May 22 '25 22:05 jeremy-msft

Hi Jeremy,

Yes, it's working now. Thanks for your support.

Could you let us know what the cause was? Was it an intermittent bug?

GANESHA1805 avatar May 24 '25 05:05 GANESHA1805

I have scheduled the workflow and have been monitoring it for the past week. It failed for two days with the same error message, indicating inconsistency. Could you please check the stability of the refreshAllDataConnections function?

We were unable to run the script. Please try again. Office JS error: Line 2: Workbook refreshAllDataConnections: There was an internal error while processing the request. clientRequestId: b0b8bb1f-54b8-4079-8034-3e678d6f5f25

GANESHA1805 avatar May 26 '25 06:05 GANESHA1805

Tagging @wandyezj to help investigate.

AlexJerabek avatar May 27 '25 02:05 AlexJerabek

Any update? as it intermediately failed with following error., not stable. Office JS error: Line 2: Workbook refreshAllDataConnections: There was an internal error while processing the request. clientRequestId: b0b8bb1f-54b8-4079-8034-3e678d6f5f25

GANESHA1805 avatar Jun 10 '25 08:06 GANESHA1805

Hi @wandyezj @AlexJerabek @jeremy-msft, The workflow is again start continuously failing since June 19th, without any success. I have tried multiple times, but I am still encountering the same error. Can you please check.

Office JS error: Line 2: Workbook refreshAllDataConnections: There was an internal error while processing the request. clientRequestId: b0b8bb1f-54b8-4079-8034-3e678d6f5f25

Thanks in advance.

GANESHA1805 avatar Jun 25 '25 08:06 GANESHA1805

Hi @GANESHA1805, could you please re-run and send a new clientRequestId so we can take a peek?

shasif-msft avatar Jul 03 '25 17:07 shasif-msft

Hi @shasif-msft , Thank you for your response. The workflow steps that run the office script have not been stable for the past two weeks. However, as of July 3rd, it is now stable and successful. How can we ensure a stable and sustainable solution moving forward?

Regards Ganesha

GANESHA1805 avatar Jul 07 '25 08:07 GANESHA1805

Hi @GANESHA1805, could you please re-run and send a new clientRequestId so we can take a peek?

can you please check thse clientRequestID Action 'Re_Run_Script' failed: We were unable to run the script. Please try again. Office JS error: Line 2: Workbook refreshAllDataConnections: There was an internal error while processing the request. clientRequestId: 86f47807-3237-45c1-ba40-6e72ed16dc09

Action 'Re_Run_Script' failed: We were unable to run the script. Please try again. Office JS error: Line 2: Workbook refreshAllDataConnections: There was an internal error while processing the request. clientRequestId: 0430eff8-4214-4cf9-a1d6-d014c6cb947c

GANESHA1805 avatar Jul 29 '25 09:07 GANESHA1805