次の方法で共有


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"]
})