Table.TransformColumnTypes

語法

Table.TransformColumnTypes(table as table, typeTransformations as list, optional culture as nullable text) as table

關於

將轉換作業套用至參數 typeTransformations 中指定的資料行 (,其中 format 為 { column name, type name}) ,使用選擇性參數 culture 中的指定文化特性傳回資料表 table (,例如 「en-US」) 。 若資料行不存在,則會擲回例外狀況。

範例 1

將資料表 ({[a = 1, b = 2], [a = 3, b = 4]}) 中資料行 [a] 內的數值轉換為文字值。

使用量

Table.TransformColumnTypes(
    Table.FromRecords({
        [a = 1, b = 2],
        [a = 3, b = 4]
    }),
    {"a", type text},
    "en-US"
)

輸出

Table.FromRecords({
    [a = "1", b = 2],
    [a = "3", b = 4]
})