Skip to content

table

Copy a table from the current model (e.g. the model workbook or JSON file) and return the table name.

table(
    tableName,
    query="",
    dataTypes=dict()
)

When using an Excel model workbook, this is equivalent to:

excelTable(
    "C:\path\to\the\model\workbook.xlsm",
    tableName,
    query,
    dataTypes,
)

Duplicate column names

If there are multiple columns with the same name, only the left-most column is kept. Column names are case-insensitive. For more info, see the page about column names.

Arguments

tableName
The name of the table to load from the source workbook.
query

An optional query to be applied to the table. See SQL queries for details.

An empty argument or empty string here means that no query will be performed, i.e. the table will be used verbatim.

dataTypes

A mapping of column names to data type specifiers. See data types for details.

When not using a SQL query:

  • For columns not given in dataTypes: The data types will be inferred from the source table. A default number format is chosen for each data type.
  • For columns given in dataTypes: The data in that column will be coerced to the specified type.

When using a SQL query:

  • For columns not given in dataTypes: The data types returned by the SQL query will be used. A default number format is chosen for each data type.
  • For columns given in dataTypes: The data in that column will be coerced to the specified type before AND after the SQL query is applied.