+ Reply to Thread
Results 1 to 8 of 8

vba to change power query data source folder

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    vba to change power query data source folder

    Hey

    I need to change folder source from this button

    1.png

    rather than I open the power query setting and click change source

    2.png

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: vba to change power query data source folder

    It's easier to just set up a parameter table with the folder path in it, as in the attached version of your file.
    Attached Files Attached Files
    Rory

  3. #3
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: vba to change power query data source folder

    Thank you!
    But can u explain how I can do that? only I give the cell name ParameterTable ? Then how I connect it with the PowerQuery Table?

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: vba to change power query data source folder

    Look at the change I made to the first step of your query.

  5. #5
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: vba to change power query data source folder

    I see but I dont knpw how to do it

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: vba to change power query data source folder

    You just need a table called Parameter Table set up like I did in your sample file.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: vba to change power query data source folder

    This video may help to understand what Rory is referring to.

    https://www.youtube.com/watch?v=LHNVkiGlUbE
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: vba to change power query data source folder

    1. Create a new range name

    fPaht
    ='New folder'!$E$1


    2. Power Query to get folder path from range name
    Please Login or Register  to view this content.
    3. VBA to put folder path at E1 and refresh all query

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Code to change Power Query source and refresh
    By kersplash in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-23-2021, 07:35 AM
  2. [SOLVED] Tabulating Source Data using Power Query
    By josephteh in forum Excel General
    Replies: 2
    Last Post: 12-29-2020, 07:54 AM
  3. Replies: 0
    Last Post: 08-25-2020, 03:56 PM
  4. Replies: 0
    Last Post: 01-14-2019, 12:59 PM
  5. Replies: 5
    Last Post: 06-29-2018, 05:35 AM
  6. Dropbox Data Host/Source for Power Query
    By mielkew27 in forum Excel General
    Replies: 0
    Last Post: 04-09-2017, 11:49 PM
  7. Power Query - Get external data from Folder
    By crainaud in forum Excel General
    Replies: 0
    Last Post: 03-24-2016, 12:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1