Forum Discussion

sway-bob's avatar
sway-bob
Copper Contributor
Sep 21, 2021
Solved

create a script

Hello community,

 

i have a excel file which take his data from the web. When i click on "refresh all" i get the current data.

so i created a script which do that for me. But unfortunately the data didn't get refreshed.

 

can anybody tell me what i have to do?

 

in following some pictures:

 

 

 

  • you can refresh all connections with this piece of code
    ThisWorkbook.RefreshAll
    or just your desired connection with
    ActiveWorkbook.Connections("YourConnectionName").Refresh

6 Replies

  • you can refresh all connections with this piece of code
    ThisWorkbook.RefreshAll
    or just your desired connection with
    ActiveWorkbook.Connections("YourConnectionName").Refresh
    • sway-bob's avatar
      sway-bob
      Copper Contributor
      the excel list is also set to "auto save".
      I run the script and open the file and see that the list has not updated. Should I have to extend the code and say that it has to save it?
      • JKPieterse's avatar
        JKPieterse
        Silver Contributor
        The script always operates on the file that you have open, so you cannot use this on a file that is not currently the active (open) file. To refresh a workbook stored on Sharepoint you can use a Flow.
  • mtarler's avatar
    mtarler
    Silver Contributor
    maybe add a calculate operation?
    workbook.getWorksheet(1).calculate
  • JKPieterse's avatar
    JKPieterse
    Silver Contributor
    So running your script does not update the data in the workbook? What about manually updating the data, does that work?

Resources