Office script to refresh all data connections of the workbook not working in PowerAutomate
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...
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.
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
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.
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?
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
Tagging @wandyezj to help investigate.
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
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.
Hi @GANESHA1805, could you please re-run and send a new clientRequestId so we can take a peek?
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
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