Office Scripts triggered on sheet activation - to Refresh all data connections

Copper Contributor

Hi,

I have recorded the below office script that refreshes all data connections. I want this script to run when a sheet named "Delivery date" is activated (i.e. when the user swaps from another sheet to this sheet)

 

It would appear that this is possible, as I found the below help article but I can't get it to work...

https://learn.microsoft.com/en-us/javascript/api/excel/excel.worksheet?view=excel-js-preview#excel-e...

 

function main(workbook: ExcelScript.Workbook) {
  // Refresh all data connections
  workbook.refreshAllDataConnections();
}
 
Thank for your help
Mike
1 Reply
The documentation you refer to pertains to the Office-JavaScript automation model, which is a different animal than Office Script. You would have to create an Office Add-in to be able to use those events.
For now, Office Script does not have any events I'm afraid.