閱讀英文

共用方式為


Table.Range

語法

Table.Range(table as table, offset as number, optional count as nullable number) as table

關於

table 傳回從指定 offset 開始的資料列。 選擇性參數 count 可指定要傳回的資料列數。 根據預設,會傳回位移之後的所有資料列。

範例 1

傳回資料表中的所有資料列,從位移 1 開始。

使用方式

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

輸出

Table.FromRecords({
    [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890"],
    [CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
})

範例 2

傳回資料表中的一個資料列,從位移 1 開始。

使用方式

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

輸出

Table.FromRecords({[CustomerID = 2, Name = "Jim", Phone = "987-6543"]})