• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

What is the best way to update a core query used across multiple different workbooks and data models?|Power Query|Excel Forum|My Online Training Hub

You are here: Home / What is the best way to update a core query used across multiple different workbooks and data models?|Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryWhat is the best way to update a co…
sp_PrintTopic sp_TopicIcon
What is the best way to update a core query used across multiple different workbooks and data models?
Avatar
Louis Burvill

New Member
Members
Level 0
Forum Posts: 2
Member Since:
November 15, 2021
sp_UserOfflineSmall Offline
1
November 15, 2021 - 8:40 pm
sp_Permalink sp_Print

Hi,

Currently I have a get and transform query that is used to pull our scheduled production for upcoming weeks and transform it into a usable data table that gets loaded into Power Pivot, this scheduling file is done in Excel and each worksheet shows production for each week of the year.

I have multiple workbooks that use this particular transform query. Currently I am just copying the query and pasting into Queries and Connections of a new workbook when I need to reuse it, however, if I ever need to make an edit to the query I have to go into each and every workbook and make the same edit in each one.

Is there a better way of managing a core query that is used across multiple workbooks so that if I ever need to make an edit I only have to do it to the main query, all the rest can be updated?

Thank you.

sp_AnswersTopicSeeAnswer See Answer
Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
November 17, 2021 - 12:44 am
sp_Permalink sp_Print

Hi Louis,

You'll have to use vba for this.

Basically, make changes in only 1 workbook query, and the query text will become the reference for all other books:

queryFormula=ThisWorkbook.Queries.Item("Query1").Formula

Set oledb = Workbooks("x.xlsx").Connections("Query - Query1").OLEDBConnection
Workbooks("x.xlsx").Queries.Item("Query1").Formula=queryFormula
oledb.Refresh
Set oledb = Workbooks("y.xlsx").Connections("Query - Query1").OLEDBConnection
Workbooks("y.xlsx").Queries.Item("Query1").Formula=queryFormula
oledb.Refresh

 

Of course, a loop can be built from a folder files, or from a list of locations.

See an idea here: https://stackoverflow.com/ques.....-using-vba

sp_AnswersTopicAnswer
Answers Post
sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Aislinn Mellamphy, Lynnette Altomari, Roy Lutke, Dieneba NDIAYE, Tucker Oakley, Natasha Smith
Guest(s) 12
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 202
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Sopi Yuniarti
sandra parker
LAFONSO HERNANDEZ
Hayden Hao
Angela chen
Sean Moore
John Chisholm
vexokeb sdfg
John Jack
Malcolm Toy
Forum Stats:
Groups: 3
Forums: 24
Topics: 6215
Posts: 27244

 

Member Stats:
Guest Posters: 49
Members: 31894
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.