excelpowerquerym

Does Power Query Choose columns prevent columns added later from being displayed/recommended way to do this


I have a situation where I have a Power Query that connects to a database, and I only want to display certain columns in my spreadsheet. I know this can easily be done with Remove Columns. However, every once in a while columns get added to the table that I'm pulling from, and I don't want those to show. I believe this can be done with Remove Other Columns (haven't tried it yet) but I was wondering if it can be done with Choose Columns (on the Home tab in the Power Query window). This would seem simpler, but the one piece of documentation I can find (https://learn.microsoft.com/en-us/power-query/choose-remove-columns) doesn't address that I see whether Choose Columns discards columns added later. I would assume it does, but is this the case? (I can't test it easily, since the database is completely out of my control.)

Also, if so, what is the recommended way of removing future columns from the query without manually adding a Remove for each - Choose Columns, Remove Other Columns, or some other way?


Solution

  • Choose Columns and Remove Other Columns both call the Table.SelectColumns() M function. You can see in the formula bar the code being generated. Both of these will prevent newly added columns from showing up later.