Table.RemoveColumns
This function eliminates the columns indicated from the given table. If the specified column does not exist, an error is triggered unless the optional parameter "missingField" is used to specify an al...
Table.RemoveColumns(table as table, columns as any, optional missingField as nullable number) as table
This function eliminates the columns indicated from the given table. If the specified column does not exist, an error is triggered unless the optional parameter "missingField" is used to specify an alternative action, such as using null values or ignoring the missing field.
Example 1
Exclude the [Phone] column from the table.
Usage:
Power Query M
MTable.RemoveColumns(
Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]}),
"Phone")
Output:
Table.FromRecords({[CustomerID = 1, Name = "Bob"]})
Example 2
Attempt to remove a column that does not exist in the table.
Usage:
Power Query M
MTable.RemoveColumns(
Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]}),
"Address")
Output:
[Expression.Error] The column 'Address' could not be found in the table.