Bagikan melalui


Table.InsertRows

Sintaksis

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

Tentang

Mengembalikan tabel dengan daftar baris, rows, yang disisipkan ke dalam table pada posisi tertentu, offset. Setiap kolom dalam baris yang akan disisipkan harus cocok dengan tipe kolom tabel.

Contoh 1

Sisipkan baris ke dalam tabel pada posisi 1.

Penggunaan

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

Output

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

Contoh 2

Sisipkan dua baris ke dalam tabel pada posisi 1.

Penggunaan

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

Output

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