Forum Discussion

Sanskruti30's avatar
Sanskruti30
Copper Contributor
Oct 23, 2023

Script not working

Hello,

I have an excel sheet which has two sheets in it which has pivot tables and i have created a script to refresh the data. The data is coming from power bi dataset.
"

function main(workbook: ExcelScript.Workbook) {
  // Refresh all data connections
  workbook.refreshAllDataConnections();

 

}"


I have triggred this in power automate. 
But when i run this only one sheets data is getting refreshed the another sheet is as it is. No changes in it. 

Any idea why it is working this way? I'm working on web excel.

Thank you in advance.

3 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Sanskruti30 

    So far in Excel for web we may refresh connections only for the source which is in the same workbook (i.e. tables or ranges within it). External data connections are not refreshed. Doesn't matter you do that manually or by script.

    • Sanskruti30's avatar
      Sanskruti30
      Copper Contributor
      But the sheet1 is getting refreshed. Only the sheet2 is not getting refreshed.
      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        Sanskruti30 

        Sorry, I missed with Power Query refreshed. With PivotTable table only it shall work. As for refreshing being on Desktop I'd uncheck background refresh, but on Web it shall be unchecked by default.

        Sorry again, have no answer.

Resources