Refresh OLE DB Query using Powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-2295334%22%20slang%3D%22en-US%22%3ERefresh%20OLE%20DB%20Query%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2295334%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20an%20Excel%20model%20with%20powerquery%20connections%20which%20I%20need%20to%20refresh.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20.RefreshAll()%20command%20refreshes%20all%20the%20connections%20and%20the%20pivot%20tables%20in%20the%20workbook%20but%20I%20want%20to%20refresh%20only%20the%20connections%20and%20not%20the%20pivot%20tables%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20I%20accomplish%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20an%20example%20of%20the%20one%20of%20the%20connections%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EApplication%20%3A%20Microsoft.Office.Interop.Excel.ApplicationClass%3C%2FP%3E%3CP%3ECreator%20%3A%201480803660%3C%2FP%3E%3CP%3EParent%20%3A%20System.__ComObject%3C%2FP%3E%3CP%3EName%20%3A%20Query%20-%20Fetch_AIO%20(REF)%20(4)%3C%2FP%3E%3CP%3EDescription%20%3A%20Connection%20to%20the%20'Fetch_AIO%20(REF)%20(4)'%20query%20in%20the%20workbook.%3C%2FP%3E%3CP%3E_Default%20%3A%20Query%20-%20Fetch_AIO%20(REF)%20(4)%3C%2FP%3E%3CP%3EType%20%3A%201%3C%2FP%3E%3CP%3EOLEDBConnection%20%3A%20System.__ComObject%3C%2FP%3E%3CP%3EODBCConnection%20%3A%3C%2FP%3E%3CP%3ERanges%20%3A%20System.__ComObject%3C%2FP%3E%3CP%3EModelConnection%20%3A%3C%2FP%3E%3CP%3EWorksheetDataConnection%20%3A%3C%2FP%3E%3CP%3ERefreshWithRefreshAll%20%3A%20True%3C%2FP%3E%3CP%3ETextConnection%20%3A%3C%2FP%3E%3CP%3EDataFeedConnection%20%3A%3C%2FP%3E%3CP%3EInModel%20%3A%20False%3C%2FP%3E%3CP%3EModelTables%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2295334%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

Hello,

 

I have an Excel model with powerquery connections which I need to refresh.

 

The .RefreshAll() command refreshes all the connections and the pivot tables in the workbook but I want to refresh only the connections and not the pivot tables

 

How do I accomplish this?

 

 

Here's an example of the one of the connections:

 

 

Application : Microsoft.Office.Interop.Excel.ApplicationClass

Creator : 1480803660

Parent : System.__ComObject

Name : Query - Fetch_AIO (REF) (4)

Description : Connection to the 'Fetch_AIO (REF) (4)' query in the workbook.

_Default : Query - Fetch_AIO (REF) (4)

Type : 1

OLEDBConnection : System.__ComObject

ODBCConnection :

Ranges : System.__ComObject

ModelConnection :

WorksheetDataConnection :

RefreshWithRefreshAll : True

TextConnection :

DataFeedConnection :

InModel : False

ModelTables

0 Replies