An array of table summary objects that are currently used in the data source.
An array of descriptions of the connections within this data source.
Gets the underlying data table for the given logical table id.
Collection of options to change the behavior of the call.
A data table containing the underlying data of the data source.
Gets the underlying data table reader for the given logical table id. Only one active DataTableReader per logical table id is supported.
logical table id.
The number of rows per page. The default and maximum is 10,000 rows.
Collection of options to change the behavior of the reader.
A data table reader to access the logical table data in the data source.
getLogicalTableDataReaderAsync
attempts to prepare all the rows of the table to be read as pages.
There is a limit to the number of rows that can be prepared. The default limit is about 1 million
rows of data. However, if the data source has many columns, this number will be adjusted downward.
You can change the default limit with the Tableau Server (Cloud) or Tableau Desktop option: ExtensionsAndEmbeddingReaderCellLimit.
If the data source has many columns, getLogicalTableDataReaderAsync
can be sped up by only requesting
native data values in the DataSourceUnderlyingDataOptions
.
The following example shows use of the getLogicalTableDataReaderAsync
and getAllPagesAsync
to
prepare pages of 10,000 rows each, and then to get a maximum of 150,000 rows of native data from
a specific logical table in a data source.
const dataSources = await worksheet.getDataSourcesAsync();
const dataSource = dataSources.find(datasource => datasource.name === "Sample - Superstore");
const logicalTables = await dataSource.getLogicalTablesAsync()
const dataTableReader = await dataSource.getLogicalTableDataReaderAsync(logicalTables[0].id, 10000,
{ includeDataValuesOption: tableau.IncludeDataValuesOption.OnlyNativeValues });
const dataTable = await dataTableReader.getAllPagesAsync(150000);
console.log(dataTable);
await dataTableReader.releaseAsync();
Gets the underlying logical tables used in the data source.
An array of logical tables that are currently used in the data source.
The following example uses the getLogicalTablesAsync
method to print the names of the
the logical tables to the console.
dataSource.getLogicalTablesAsync().then(function (logicalTables) {
// Loop through each table that was used in creating this data source
logicalTables.forEach(function (table) {
console.log(table.caption);
});
});
Collection of options to change the behavior of the call.
Returns a promise containing a page of data from the underlying data of the data source.
The following example shows use of the getUnderlyingDataAsync()
method to get the underlying data from a specific data source.
The example uses the JavaScript find()
method to select the workbook and data source.
const dataSources = await worksheet.getDataSourcesAsync();
const dataSource = dataSources.find(datasource => datasource.name === "Sample - Superstore");
const dataTable = await dataSource.getUnderlyingDataAsync();
let field = dataTable.columns.find(column => column.fieldName === "Sub-Category");
let list = [];
for (let row of dataTable.data) {
list.push(row[field.index].value);
}
let values = list.filter((el, i, arr) => arr.indexOf(el) === i);
console.log(values);
This call has the same functionality as clicking the Refresh option on a data source in Tableau. This does not refresh an extract.
Note: The refreshAsync()
method is intended to be used in scenarios where manual
interaction causes a need to refresh the data in the Tableau visualization. The method is not,
as currently designed, meant to support or emulate streaming or live visualizations.
Extensions that use the method to refresh aggressively or automatically
can cause issues on Tableau Server and Tableau Online and are subject to being blocked
by the Tableau Online administrator.
This call does not currently support refreshing live Google Sheet data sources.
Promise that resolves when the data source has finished refreshing.
Represents the data source used by a Worksheet.