跳到主要内容

Table.RemoveColumns

删除指定的列。

Syntax

Table.RemoveColumns(
table as table,
columns as any,
optional missingField as MissingField.Type
) as table

Remarks

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

Examples

Example #1

从表中删除列 [Phone]。

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

Result:

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

Example #2

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

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

Result:

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

Category

Table.Column operations