+ Reply to Thread
Results 1 to 4 of 4

Power Query - list sheet names of original data

  1. #1
    Registered User
    Join Date
    11-11-2020
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    49

    Power Query - list sheet names of original data

    Hi there,

    I have 3 sheets of data from 3 different tables, where I have used Power Query to consolidate into a single table (under Summary Tab).
    However, I'd like to a column in the Power Query table, that lists the sheet name for each item that can be found from the original source (see expected results).

    Expected.png

    I have also attached the Excel file here for your information.

    Thank you for your help.

    Ken
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,370

    Re: Power Query - list sheet names of original data

    Hi kehong,

    See the attached with an answer.
    PQ Conditional Column SheetName.xlsx

    If you didn't have Tables and only worksheets then watch this:
    https://www.youtube.com/watch?v=-787a_89BZk&t=2s
    I will need to watch this many times to understand all of it.
    Last edited by MarvinP; 04-12-2022 at 09:09 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    11-11-2020
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    49

    Re: Power Query - list sheet names of original data

    Hi Marvin,

    Thank you for this.
    However, when I try to add a new sheet and create a new table. The PowerQuery cannot identify the new data is from this new sheet.
    Presumably, this is because the following code does not cover any new sheet being added?

    Please Login or Register  to view this content.
    I have attached my problem here.

    Would you be able to find a solution for this, so I can add new sheet, and all new data and sheet information can be transferred to the PQ summary table?

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,370

    Re: Power Query - list sheet names of original data

    OK kehong,

    You need to save the workbook to a drive before using this PQ script and pull the data from the saved workbook. Also, I've converted all sheet tables to ranges so the sheet is offered to select. If you add a new sheet you will need to save the workbook to a file before running the script
    PQ from Sheets keeping names.xlsx
    See if this does what you need.

    If not then watch the link above which goes through why pulling sheets is not yet a function in PQ but files in a folder is.

+ 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. Replies: 4
    Last Post: 01-18-2022, 05:07 AM
  2. Replies: 1
    Last Post: 10-25-2021, 06:12 PM
  3. Power Query - rearrange one row into multiple with same original two columns
    By jdras in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-26-2021, 11:08 AM
  4. Power Query - column names with brackets
    By afgi in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-07-2020, 07:55 AM
  5. [SOLVED] Blank cells in Power Query, data existing in original source
    By kirootsouthpark in forum Excel General
    Replies: 4
    Last Post: 08-25-2020, 05:05 PM
  6. VBA / Power Query to copy sheet 1 data to sheet 2 below the last used row
    By mukuljain99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2020, 04:52 AM
  7. [SOLVED] Power query change column names
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2020, 04:45 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