Table.RemoveColumns

语法

Table.RemoveColumns(table as table, columns as any, optional missingField as nullable number) as table

关于

从提供的 table 删除指定的 columns。 如果指定的列不存在,则会引发错误,除非可选参数 missingField 执行了替代行为(例如 MissingField.UseNullMissingField.Ignore)。

示例 1

从表中删除列 [Phone]。

使用情况

Table.RemoveColumns(
    Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]}),
    "Phone"
)

输出

Table.FromRecords({[CustomerID = 1, Name = "Bob"]})

示例 2

尝试从表中移除不存在的列。

使用情况

Table.RemoveColumns(
    Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]}),
    "Address"
)

输出

[Expression.Error] The column 'Address' of the table wasn't found.