Forum Discussion

IB_rewoP's avatar
IB_rewoP
Frequent Visitor
1 year ago
Solved

Auto Refresh Power Query in Excel with Web Content Connection

hi community,   I have a power query set up in excel that has a connection to web contents and I have set the query to refresh every 6 minutes and checked the enable background refresh.  Also the q...
  • Poojara_D12's avatar
    1 year ago

    Hi IB_rewoP 

     

    • Why It Doesn’t Work:

      • Auto-refresh only works when the Excel file is open. Closing the file stops the refresh.
      • "Enable Background Refresh" only allows Excel to continue working while refreshing but doesn’t apply when the file is closed.
    • Solution:

      • Use VBA: Add this code to refresh when the file opens:

     

    Private Sub Workbook_Open()
        ThisWorkbook.RefreshAll
    End Sub
    ​

     

    • Save the file as a macro-enabled workbook (.xlsm).
    • Power Automate: Use it to refresh the file if stored in OneDrive/SharePoint.
    • Query Properties: Right-click the query in Data > Queries & Connections, select Properties, and check:
      • "Refresh every X minutes"
      • "Refresh data when opening the file."

    Did I answer your question? Mark my post as a solution, this will help others!
    If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

    Kind Regards,
    Poojara
    Data Analyst | MSBI Developer | Power BI Consultant
    Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS