Change Target Table Name in Power Query

Raddle

New Member
Joined
Oct 24, 2023
Messages
41
Office Version
  1. 2016
Hi
I am pointing my PQ at a file in a folder and within the file at a specific table name.
The file has several tables with different names.
Is it possible to duplicate the query and change the table name, so that I don't need to recreate the query from scratch?
This would obvs be a huge time saver.

As I type I sense that there is something wrong the approach but I need to ask this possibly dumb question .... :)

thanking you in advance.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Yes, it's possible to duplicate a Power Query and change the table name without recreating the entire query from scratch. Here are the general steps to achieve this:

1. Open the Power Query Editor:
In Excel, go to the "Data" tab.
Click on "Get Data" or "Get & Transform Data" (depending on your Excel version).
Select "Show Queries" to open the Power Query Editor.

2. In the Power Query Editor:
Locate the query you want to duplicate in the "Queries" pane on the left.
Right-click on the query you want to duplicate.
Choose "Duplicate" from the context menu.

3. Rename the duplicated query:
Double-click on the query name in the "Queries" pane.
Enter a new name for the duplicated query.

4. Modify the source table reference:
In the duplicated query, you'll need to change the source table reference to point to a different table. You can do this by editing the source step in the query.

5. Adjust any other necessary steps:
Depending on your specific requirements, you may need to adjust other steps in the duplicated query, such as filtering, transformations, or column renaming.

6. Load the duplicated query:
Once you've made the necessary changes, click the "Close & Load" button to load the duplicated query into Excel.

By following these steps, you can duplicate a Power Query and customize it for a different table without recreating the entire query from scratch. This can save you time and effort when working with similar data structures.
 
Upvote 0
Solution
If you are doing the same thing(s) to each table, you should probably be making a function that you can call from other queries.
 
Upvote 1
need to adjust other steps in the duplicated query, such as filtering, transformations, or column renaming.
Yes, it's possible to duplicate a Power Query and change the table name without recreating the entire query from scratch. Here are the general steps to achieve this:

1. Open the Power Query Editor:
In Excel, go to the "Data" tab.
Click on "Get Data" or "Get & Transform Data" (depending on your Excel version).
Select "Show Queries" to open the Power Query Editor.

2. In the Power Query Editor:
Locate the query you want to duplicate in the "Queries" pane on the left.
Right-click on the query you want to duplicate.
Choose "Duplicate" from the context menu.

3. Rename the duplicated query:
Double-click on the query name in the "Queries" pane.
Enter a new name for the duplicated query.

4. Modify the source table reference:
In the duplicated query, you'll need to change the source table reference to point to a different table. You can do this by editing the source step in the query.

5. Adjust any other necessary steps:
Depending on your specific requirements, you may need to adjust other steps in the duplicated query, such as filtering, transformations, or column renaming.

6. Load the duplicated query:
Once you've made the necessary changes, click the "Close & Load" button to load the duplicated query into Excel.

By following these steps, you can duplicate a Power Query and customize it for a different table without recreating the entire query from scratch. This can save you time and effort when working with similar data structures.
Hey thank you both so much ...

so in the source step, all I get is the file path .. I don't seem to see the table name ...

What I want to be able to do, is dupe that query, and then instead of pointing to tbl_RED, change it to point to tbl_Blue.

If that helps to explain
 
Upvote 0
This will go much faster if you post the M code. ;)
 
Upvote 0
oooh hang on. Wow. I need another knock on the head don't I. So you need to go back to Source and then click the double down arrow and choose the next table .... I think. Will have a play.

I was kind of expecting to see somewhere in the code, a reference to tbl_RED that I woudl be able to change to tbl_BLUE (almost like parameterisation).

Ok so let me not waste any more of your time.

Thank you !
 
Upvote 0

Forum statistics

Threads
1,223,935
Messages
6,175,498
Members
452,649
Latest member
mr_bhavesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top