Q: Power Query- Adding Custom Column Showing Table's Name

Tuta

Board Regular
Joined
Nov 6, 2008
Messages
85
Office Version
  1. 365
Platform
  1. Windows
All,

I'm trying to write a query that will add a custom column.

In this custom column, I need the Table's name in each row. I just can't seem to find out the proper way to grab the table's name and add it.

Thanks!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Miguel -- it's a web page.

PQ finds several Tables available at the URL, I want to iterate through those tables, adding a custom column with each Table's name.
 
Upvote 0
it might be easier than what you think. I haven't tested this but you could go to the actual page and then expand the table from there. Kinda like the same approach when you import from folder but with web queries it always depends on how your source looks like
 
Upvote 0
Anyone have any more ideas on this?

I can't believe I figured this out.. lol I am always so dependent on the help of others I felt the need to share my findings.

I also am using a web page to pull several tables and wanted the "table name" to be associated with the data automatically. I wanted this not to be manual so the connection will be automated and auto input the unique table identifier.

After you add all the tables you want from the URL if you highlight one at a time and select Advanced Editor it should show you a the source as a webpage and then a Data# = Source{#}[Data]. The Source # should be unique to each table it pulled in. That source # is referencing the table. Several minutes of tinkering led me to the following code for a custom column. "=Source{#}[Caption]". Adjust the # to whatever the source number shows on your table you are connected to on the URL.

I know this is from 2014 but I am still having this problem in 2019 and can't find a solution. This worked for me. Hopefully it is a good fix.
 
Upvote 0
I can't believe I figured this out.. lol I am always so dependent on the help of others I felt the need to share my findings.

I also am using a web page to pull several tables and wanted the "table name" to be associated with the data automatically. I wanted this not to be manual so the connection will be automated and auto input the unique table identifier.

After you add all the tables you want from the URL if you highlight one at a time and select Advanced Editor it should show you a the source as a webpage and then a Data# = Source{#}[Data]. The Source # should be unique to each table it pulled in. That source # is referencing the table. Several minutes of tinkering led me to the following code for a custom column. "=Source{#}[Caption]". Adjust the # to whatever the source number shows on your table you are connected to on the URL.

I know this is from 2014 but I am still having this problem in 2019 and can't find a solution. This worked for me. Hopefully it is a good fix.

Forgot to explain.

This works for my use because the source # will not change on my URL connection but the table names will all change. As long as I had the Source #'s matching the connection pull it will auto input the table name each time it updates. This may not work for every use but it will under these circumstances.
 
Upvote 0
man -- I wish I could remember what I was trying to do!! :LOL:
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,424
Members
448,896
Latest member
MadMarty

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