Teilen über


Table.FromList

Syntax

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

About

Konvertiert eine Liste in eine Tabelle, list indem sie die optionale Aufspaltungsfunktionsplitter auf jedes Element in der Liste anwendet. Standardmäßig wird davon ausgegangen, dass es sich bei der Liste um eine Liste von Textwerten handelt, die durch Kommas geteilt werden. Optional columns kann die Anzahl der Spalten, eine Liste von Spalten oder ein TableType-Objekt sein. Optional default und extraValues kann auch angegeben werden.

Beispiel 1

Erstellen Sie eine Tabelle aus einer Liste mithilfe des Standardteilers.

Verwendung

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

Output

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

Beispiel 2

Erstellen Sie eine Tabelle aus einer Liste mit einem benutzerdefinierten Teiler.

Verwendung

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

Output

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

Beispiel 3

Erstellen Sie mithilfe des Record.FieldValues Splitters eine Tabelle aus der Liste.

Verwendung

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

Output

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