語法
Table.RemoveColumns(
table as table,
columns as any,
optional missingField as nullable number
) as table
關於
從所提供的 columns 中移除指定的 table。 若指定的欄位不存在,則會產生錯誤,除非選用參數 missingField 指定替代行為(例如, MissingField.UseNull 或 MissingField.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.