Table.SelectColumns [Applies to Power Query]

This topic applies to the Power Query Formula Language. With Power Query you can discover, combine and refine data. To learn more about Power Query formulas in Excel, see Create Power Query formulas in Excel. For Excel VBA help, see Excel 2013 developer reference.

About

Returns a table that contains only specific columns.

Table.SelectColumns(table as table, columns as any, optional missingField as any) as table  

Arguments

Argument

Description

table

The Table to modify.

columns

The list of columns to copy.

optional missingField

The default value of missingField is MissingField.Error. For more information, see Parameter Values.

Remarks

  • Table.SelectColumns is similar to Record.SelectFields applied to every row in a table.

Examples

Table.SelectColumns(Table.FromRecords({[A=1, B=2]}), "B") equals Table.FromRecords({[B=2]})
Table.SelectColumns(Table.FromRecords({[A=1, B=2, C=3]}), {"C", "B"}) equals Table.FromRecords({[B=2, C=3]})
Table.SelectColumns(Table.FromRecords({[A=1, B=2]}), "X") equals Expression.Error
Table.SelectColumns(Table.FromRecords({[A=1, B=2]}), "X", MissingField.Ignore) equals Table.FromRecords({[]})
Table.SelectColumns(Table.FromRecords({[A=1 ,B=2]}), "X", MissingField.UseNull) equals Table.FromRecords({[X=null]})

Applies To: Excel 2013, Excel 2010



Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Support resources

Change language