+ Reply to Thread
Results 1 to 2 of 2

Can I have a code to change the Power Query Source location?

  1. #1
    Registered User
    Join Date
    12-20-2019
    Location
    South Dakota
    MS-Off Ver
    365
    Posts
    56

    Can I have a code to change the Power Query Source location?

    I want to be able to change where the target designation is for where a Query, retrieving data from a txt file for referenced entry into an excel document.

    I know how I can go into the power query editor, go to the advanced editor, and manually change the file path for whatever I want... "C:\Users\Etcetera\File.txt" And I do this to preferably update the source reference, because the power query is taking numbers that are divided by tabs, which for whatever reason just adding a reference to text/csv files refuses to accept tabs as dilimeter, and formats all the numbers as text... but, if I go into the power query, I could split the columns, tell it to split by tab and suddenly it worked... and then tell it the format of each column is decimal numbers instead of text. But, either I have to go through this every time I want to set it up to reference a text document, or if I could just change the source reference.

    In the Advanced Editor I have this line:
    Please Login or Register  to view this content.
    Which if I update that pathway then it updates where it pulls data from.

    I would also like this associated with a worksheet change code - so I just have to type the file pathway in a cell and it updates the advanced editor.

    Please Login or Register  to view this content.
    Obviously the ListObject.QueryTable.Source is not correct... so what would be?

    Thanks

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,761

    Re: Can I have a code to change the Power Query Source location?

    You can build a parameter query that will allow you to select or write the path to the file you want.

    https://www.youtube.com/watch?v=0NX-GctfZuU
    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

+ 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. vba to change power query data source folder
    By Undo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2021, 11:29 PM
  3. [SOLVED] Power Query connect to source only once
    By jaryszek in forum Excel General
    Replies: 4
    Last Post: 11-03-2020, 12:39 PM
  4. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  5. Replies: 5
    Last Post: 06-29-2018, 05:35 AM
  6. Power Query Source vs Different PCs
    By flpneves in forum Excel General
    Replies: 1
    Last Post: 12-05-2017, 01:07 PM
  7. Does My VBA Code To Refresh CSV Power Query Connections Need To Change for MySQL Queries?
    By beaglesBuddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2017, 02:57 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