Show Columns dynamically

kensel

New Member
Joined
Feb 8, 2019
Messages
1
Hello,

I'm looking for a way, preferably Power Query, to have a sheet with a table or text file with column names that are visible when loading a spreadsheet.

For example I have a csv with the following columns:

Caption​
IP_Address​
AgentPort​
Allow64BitCounters​
AvgResponseTime​
BlockUntil​
BufferBgMissThisHour​
BufferBgMissToday​


<colgroup><col></colgroup><tbody>
</tbody>

I have created a Sheet with the table:
ColumnShow
CaptionTRUE
IP_AddressTRUE
AgentPortFALSE
Allow64BitCountersFALSE
AvgResponseTimeFALSE
BlockUntilFALSE
BufferBgMissThisHourFALSE
BufferBgMissTodayFALSE
I would like the Load query to load the Columns that show true. I have the following query to get the list of columns to keep but I don't know how to have the CSV load query remove the extra columns.

let​
Source = Excel.CurrentWorkbook(){[Name="ColumnList"]}[Content],​
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column", type text}, {"Show", type logical}}),​
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Show] = true)),​
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Show"})​
in​
#"Removed Columns"​

I found a stack overflow that shows how to hide a column that I might look at trying to modify with my beginner VBA skills to hide the unwanted columns. https://stackoverflow.com/questions/45110022/excel-macro-hide-columns-based-on-string

Possible Addition once working: I might expand it and add a profile column to make it so that specific columns are shown depending on the profile.

Reason: I would like to make this so that I can have one workbook that imports the data from a single regularly updated CSV and show different sets of data depending on what I'm working on.

Thank you,
Kensel



<colgroup><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,214,542
Messages
6,120,116
Members
448,945
Latest member
Vmanchoppy

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