ChooseCols

 ๐Ÿ” Detailed Example: Table.ChooseColumns

๐Ÿ“ Step 1: Prepare Your Table in Excel

Create a table in Excel (select data → Ctrl + T).

๐Ÿงพ Sample Table:

ID

Name

Age

Score

1

Alice

28

90

2

Bob

30

85

3

Charlie

27

92

Table Name: Table1 (default or renamed)

We want to keep only the Name and Score columns.

๐Ÿงญ Step 2: Load Data into Power Query

Select any cell in the table.

Go to the Data tab → Click From Table/Range under Get & Transform.

Power Query Editor will open with your table loaded.

๐Ÿงช Step 3: Use the Table.ChooseColumns Function

๐Ÿ“ Option A: Formula Bar

If the formula bar isn’t visible:

Go to the View tab in Power Query → ✅ Check "Formula Bar".

Then update the formula like this:

m

CopyEdit

= Table.ChooseColumns(Source, {"Name", "Score"})

๐Ÿ“ Option B: Advanced Editor

Go to HomeAdvanced Editor.

Replace the code like this:

m

CopyEdit

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], SelectedColumns = Table.ChooseColumns(Source, {"Name", "Score"}) in SelectedColumns

✅ What It Does:

Source: your full table.

Table.ChooseColumns: picks only the Name and Score columns.

The output removes other columns (ID, Age) completely.

๐Ÿ“„ Result Preview in Power Query:

Name

Score

Alice

90

Bob

85

Charlie

92

๐Ÿ“ฅ Step 4: Load the Result Back to Excel

Click HomeClose & Load.

The filtered table (only Name and Score) appears in a new Excel sheet.

๐Ÿ’ก Tips

๐Ÿ”ง Feature

๐Ÿ“ Description

Table.ChooseColumns

Selects only columns listed by name

Column names are case-sensitive

"Name" ≠ "name"

Use curly brackets {}

To specify column names in a list format

Let me know if you'd like to:

See this example in Power BI

Download a sample Excel file

Make it dynamic (e.g., select columns based on a condition)