Results 1 to 4 of 4

Thread: Working with Column Headers in Power Query

  1. #1

    Working with Column Headers in Power Query



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi,

    When I work in Power Query on one of the sheets that I loaded from another excel workbooks I do some manipulation.

    Unpivot, Reorder and some other functions. In the end if someone will change one of the columns headers in my workbook all my work will be wasted since in my steps in power query when I checked, I saw that all the manipulation I did in Advance editor are using Column Names .

    Is there any other opthion to make the steps (reorder, unpivot, etc.) without using column name?

  2. #2
    Conjurer Ed Kelly's Avatar
    Join Date
    Jul 2016
    Posts
    164
    Articles
    0
    Excel Version
    2016
    Igor,

    Not aware of any options. The easiest solution tell the user not to change the column headers, failing that be prepared to edit the advanced editor with those changes (which is not a lot of fun) or finally consider building out a few queries within the same workbook and have your user self select based on the matching structure.

  3. #3
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,401
    Articles
    45
    Blog Entries
    14
    Excel Version
    Excel Office 365 Insider
    Yes, but it's a bit complex.

    Basically, you suck in the table, then reference that query twice.

    In the first, you remove all rows, then demote the headers.

    In the second, you demote the headers, remove the top row, then do the work you need to do.

    You then create a new query to append Query2 to Query1, promote the first row to headers, and load it out. The big challenge is that you cannot change the data types in the final query, as that hard codes to column headers, which will break your query.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  4. #4

Posting Permissions

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