Table.SelectColumns

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