Did you find a solution? @jetjet
Excel Scripts - refreshAllDataConnections()
I'm using Excel Online and have a very simple Excel Script that I want to trigger via Power Automate
The script is
function main(workbook: ExcelScript.Workbook) {
// Refresh all data connections
workbook.refreshAllDataConnections();
}
When I trigger this script from Excel Online, nothing will happen.
But, if use the UI to click on the 'Refresh All Connections' button I get the below the prompt
Be careful. The query to get the data might be unsafe so you should only refresh the workbook if you trust its source.
Do you want to refresh the workbook?
I click Yes and then try running my Script again and it works beautifully refreshing the data. But as soon as I reload the page in Chrome, the script won't work until I follow the process above again.
How can I trust the connection or add some code in the script to ignore this message?
The excel file is on my OneDrive for Business and I've tried adding that folder as a trusted folder in Excel Desktop without any luck. The connection is to a PowerBI OLAP if that makes a difference