Table.TransformColumnTypes

语法

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

关于

通过对在参数 typeTransformations 中指定的列应用转换操作(其中格式为 { column name, type name}),使用可选参数 culture 中的指定区域性(例如“en-US”),从输入 table 中返回一个表。 如果该列不存在,则引发异常。

示例 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]
})