Table.FromList

構文

Table.FromList(list as list, optional splitter as nullable function, optional columns as any, optional default as any, optional extraValues as nullable number) as table

バージョン情報

任意の分割関数である splitter をリストの各項目に適用して、リスト list をテーブルに変換します。 既定では、リストはコンマで区切られたテキスト値のリストであると見なされます。 省略可能な columns には、列の数、列のリスト、または TableType を指定できます。 必要に応じて、defaultextraValues を指定することもできます。

例 1

既定のスプリッターを使用して、リストからテーブルを作成します。

使用方法

Table.FromList(
    {"a,apple", "b,ball", "c,cookie", "d,door"},
    null,
    {"Letter", "Example Word"}
)

出力

Table.FromRecords({
    [Letter = "a", #"Example Word" = "apple"],
    [Letter = "b", #"Example Word" = "ball"],
    [Letter = "c", #"Example Word" = "cookie"],
    [Letter = "d", #"Example Word" = "door"]
})

例 2

カスタム スプリッターを使用して、リストからテーブルを作成します。

使用方法

Table.FromList(
    {"a,apple", "b,ball", "c,cookie", "d,door"},
    Splitter.SplitByNothing(),
    {"Letter and Example Word"}
)

出力

Table.FromRecords({
    [#"Letter and Example Word" = "a,apple"],
    [#"Letter and Example Word" = "b,ball"],
    [#"Letter and Example Word" = "c,cookie"],
    [#"Letter and Example Word" = "d,door"]
})

例 3

Record.FieldValues スプリッターを使用して、リストからテーブルを作成します。

使用方法

Table.FromList(
    {
        [CustomerID = 1, Name = "Bob"],
        [CustomerID = 2, Name = "Jim"]
    },
    Record.FieldValues,
    {"CustomerID", "Name"}
)

出力

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