Läs på engelska

Dela via


Table.InsertRows

Syntax

Table.InsertRows(table as table, offset as number, rows as list) as table

Om

Returnerar en tabell med listan med rader, rows, infogade i table vid den angivna positionen offset. Varje kolumn i raden som ska infogas måste matcha kolumntyperna i tabellen.

Exempel 1

Infoga raden i tabellen vid position 1.

Användning

Table.InsertRows(
    Table.FromRecords({
        [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
        [CustomerID = 2, Name = "Jim", Phone = "987-6543"]
    }),
    1,
    {[CustomerID = 3, Name = "Paul", Phone = "543-7890"]}
)

utdata

Table.FromRecords({
    [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890"],
    [CustomerID = 2, Name = "Jim", Phone = "987-6543"]
})

Exempel 2

Infoga två rader i tabellen vid position 1.

Användning

Table.InsertRows(
    Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]}),
    1,
    {
        [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
        [CustomerID = 3, Name = "Paul", Phone = "543-7890"]
    }
)

utdata

Table.FromRecords({
    [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
    [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890"]
})