How to Refresh Data Connection in Excel Without Opening File: 2 Methods

Method 1 – Utilize Excel Power Query to Refresh File Data Connection Without Opening

STEPS:

  • Open the “reloadedData” and go to the PowerQueryR sheet.
  • Select the B2 cell.
  • Go to the Data tab.
  • Click the Get Data icon.

Utilize Excel Power Query to Refresh File Data Connection Without Opening

  • A menu bar will open.
  • Choose the From File option, followed by From Excel Workbook.

  • Find the “SourceData” file and click Import.

  • The Navigator window will open up.
  • Pick the PowerQueryS sheet from the list.
  • Go to the Load icon, followed by Load To.

Utilize Excel Power Query to Refresh File Data Connection Without Opening

  • The Import Data window will pop up.
  • Check the Existing worksheet, hit OK.

  • The data is fetched from the resource file to the store file, as shown below.

  • Navigate to the Data tab, followed by Refresh All to open a menu bar.
  • Choose Connection Properties.

Utilize Excel Power Query to Refresh File Data Connection Without Opening

  • The Query Properties open.
  • Check the Refresh every and type 1 in the Input box.
  • Hit OK.

Utilize Excel Power Query to Refresh File Data Connection Without Opening

  • Open the “SourceData” file and pick the PowerQueryS sheet.
  • Select B8.
  • Remove the value and type MIT, hit Enter.
  • Press Ctrl+S.

  • 1 minute later, go to “reloadedData” file to see the intended output.

Output of Utilizing Excel Power Query to Refresh File Data Connection Without Opening


Method 2 – Reload Data Connection Without Opening File Through Excel VBA

STEPS:

  • Go to the “reloadedData” file and make the ExcelVBAR an active sheet.
  • Pick the B2 cell.
  • Follow the previously described procedure to open the Navigator window.
  • Choose the ExcelVBAS sheet this time.
  • Go to Load, followed by Load To.

Reload Data Connection Without Opening File Through Excel VBA

  • The Import Data window pops up.
  • Check the Existing worksheet and hit OK.

  • The intended data will be fetched from the resource file.

Reload Data Connection Without Opening File Through Excel VBA

  • Navigate to Developer.
  • Click Visual Basic.

Reload Data Connection Without Opening File Through Excel VBA

  • Select Insert, followed by Module.

  • Enter the following code into the Module box.
Public ReloadInterval As Double
Public Const Period = 30
Sub Reload()
  MsgBox "Updates will begin to occur at " & _
    "the interval of " & Period & " seconds"
  Call FirstReload
End Sub
Sub FirstReload()
  ReloadInterval = Now + TimeSerial(0, 0, Period)
  Application.OnTime _
    EarliestTime:=ReloadInterval, _
    Procedure:="ReloadConnections", _
    Schedule:=True
End Sub
Sub ReloadConnections()
  ThisWorkbook.RefreshAll
  Call FirstReload
End Sub
  • Press F5 or click Run.

Reload Data Connection Without Opening File Through Excel VBA

  • The Macros window will open.
  • Choose the Reload macros and hit Run.

  • A small Microsoft Excel window pops, and click OK.

  • Go to the “SourceData” file and choose the ExcelVBAS sheet.
  • Select B8.
  • Remove the value and type MIT, hit Enter or Tab.
  • Press Ctrl+S.

  • 30 seconds later, go to the “reloadedData” file to get the desired output.

Output of Reloading Data Connection Without Opening File Through Excel VBA

 


Download Practice Workbook

The sample workbooks used during the workshop are free to download for all attendees.


Related Articles

<< Go Back to Excel Data Connections | Importing Data in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Lutfor Rahman Shimanto
Lutfor Rahman Shimanto

Lutfor Rahman Shimanto, BSc, Information Technology, Jahangirnagar University, Bangladesh, has worked with the ExcelDemy project for over a year. He has written 50+ articles and provided solutions of 100+ comments for ExcelDemy. Currently, he works as an Excel & VBA Developer and provides support and solutions in the ExcelDemy Forum. He has solved 100+ ExcelDemy Forum problems. His work and learning interests are in developing various Excel & VBA and Desktop applications. Outside of work, he enjoys Chess... Read Full Bio

2 Comments
  1. Life saver, cheers. Had an issue with a Power Query refresh in excel but this has nailed it, thanks. I changed to 3600 seconds for 1 hr. I used the macro VBA option.

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo