Type.TableRow

Type

Returns the row type of a table type.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Type.TableRow(table as type) as type

Parameters

NameTypeRequiredDescription
tabletypeYesA table type to extract the row type from.

Return Value

typeThe record type representing a single row of the table type.

Remarks

Type.TableRow extracts the row type (a record type) from a table type. The returned record type describes the structure of a single row — its field names and their types.

For example, given type table [Name = text, Age = number], Type.TableRow returns a record type equivalent to type [Name = text, Age = number].

This is useful for:

- Introspecting table schemas programmatically. - Building generic functions that adapt to the structure of their input tables. - Combining with Type.ForFunction to construct function signatures dynamically.

If the input type is not a table type, the function raises an error.

Examples

Example 1: Inspect row type of a table type

let
    MyTableType = type table [Name = text, Score = number],
    RowType = Type.TableRow(MyTableType),
    IsRecord = Type.Is(RowType, type record)
in
    #table({"TableType", "RowType IsRecord"}, {{"type table [Name, Score]", IsRecord}})
Result
TableType
RowType IsRecord
1type table [Name, Score]TRUE

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks