---
schema_version: "1"
id: 4c211078421f45f223afe4fe1bd0ba7e404e4593a649eb0bdc083129e5341b98
title: DataSource | Tableau Embedding API
collection: tableau
version: next
locale: en-us
portal_url: https://docs.salesforce.com/tableau/next/en-us/api/embedding_api/reference/interfaces/DataSource.md
canonical_url: https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataSource.html
source_site: help.tableau.com
content_type: documentation
content_hash: 1c3e6e7d69cefb0d9ea3a512a09ef1913e575010a3fd7aa5f93da83cdf7879bf
description: Documentation for Tableau Embedding API
---
- DataSource

# Interface DataSource

Represents the data source used by a Worksheet.

interface DataSource {  
    [extractUpdateTime](#extractupdatetime): undefined | string;  
    [fields](#fields): [Field](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/Field.html)\[\];  
    [id](#id): string;  
    [isExtract](#isextract): boolean;  
    [isPublished](#ispublished): undefined | boolean;  
    [name](#name): string;  
    [getActiveTablesAsync](#getactivetablesasync-1)(): Promise<[TableSummary](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/TableSummary.html)\[\]\>;  
    [getConnectionSummariesAsync](#getconnectionsummariesasync-1)(): Promise<[ConnectionSummary](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/ConnectionSummary.html)\[\]\>;  
    [getLogicalTableDataAsync](#getlogicaltabledataasync-1)(  
        logicalTableId: string,  
        options?: [DataSourceUnderlyingDataOptions](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataSourceUnderlyingDataOptions.html),  
    ): Promise<[DataTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataTable.html)\>;  
    [getLogicalTablesAsync](#getlogicaltablesasync-1)(): Promise<[LogicalTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/LogicalTable.html)\[\]\>;  
    [getUnderlyingDataAsync](#getunderlyingdataasync-1)(  
        options?: [DataSourceUnderlyingDataOptions](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataSourceUnderlyingDataOptions.html),  
    ): Promise<[DataTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataTable.html)\>;  
    [refreshAsync](#refreshasync-1)(): Promise<void\>;  
}

- Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:16

##### Index

### Methods

[getActiveTablesAsync](#getactivetablesasync) [getConnectionSummariesAsync](#getconnectionsummariesasync) [getLogicalTableDataAsync](#getlogicaltabledataasync) [getLogicalTablesAsync](#getlogicaltablesasync) [getUnderlyingDataAsync](#getunderlyingdataasync) [refreshAsync](#refreshasync)

### Properties

[extractUpdateTime](#extractupdatetime) [fields](#fields) [id](#id) [isExtract](#isextract) [isPublished](#ispublished) [name](#name)

## Methods

### getActiveTablesAsync[](#getactivetablesasync)

- getActiveTablesAsync(): Promise<[TableSummary](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/TableSummary.html)\[\]\>[](#getactivetablesasync-1)
    
    #### Returns Promise<[TableSummary](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/TableSummary.html)\[\]\>
    
    An array of table summary objects that are currently used in the data source.
    
    #### Throws[](#throws)
    
    UnsupportedMethodForDataSourceType error if this method is called on a Cube DataSource or GA.
    
    #### Deprecated[](#deprecated)
    
    since version 1.4.0. Use DataSource.getLogicalTablesAsync.
    
    - Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:79

### getConnectionSummariesAsync[](#getconnectionsummariesasync)

- getConnectionSummariesAsync(): Promise<[ConnectionSummary](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/ConnectionSummary.html)\[\]\>[](#getconnectionsummariesasync-1)
    
    #### Returns Promise<[ConnectionSummary](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/ConnectionSummary.html)\[\]\>
    
    An array of descriptions of the connections within this data source.
    
    - Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:84

### getLogicalTableDataAsync[](#getlogicaltabledataasync)

- getLogicalTableDataAsync(  
        logicalTableId: string,  
        options?: [DataSourceUnderlyingDataOptions](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataSourceUnderlyingDataOptions.html),  
    ): Promise<[DataTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataTable.html)\>[](#getlogicaltabledataasync-1)
    
    Gets the underlying data table for the given logical table id.
    
    #### Parameters
    
    - logicalTableId: string
    - `Optional`options: [DataSourceUnderlyingDataOptions](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataSourceUnderlyingDataOptions.html)
        
        Collection of options to change the behavior of the call.
    
    #### Returns Promise<[DataTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataTable.html)\>
    
    A data table containing the underlying data of the data source.
    
    #### See[](#see)
    
    getLogicalTableDataReaderAsync to read more than 10,000 rows.
    
    You can use the `getUnderlyingDataOptions.maxRows` property to request the number of rows of data to return. If unspecified (maxRows == '0'), the call to `getLogicalTableDataAsync` requests all rows in the logical table. Note that the maximum number of rows returned from the `getLogicalTableDataAsync()` method is limited to 10,000 rows. You can use the `DataTable` property, `isTotalRowCountLimited`, to test whether there is more data. A value of true indicates that the calling function requested more rows than the limit (10,000) and the underlying data source contains more rows than can be returned.
    
    The following example shows use of the getLogicalTableDataAsync() method to get the data from a specific logical table in a data source. The example uses the JavaScript find() method to select the workbook, and uses the getLogicalTablesAsync method to identify the logical table id.
    
    ```
    const dataSources = await worksheet.getDataSourcesAsync();const dataSource = dataSources.find(datasource => datasource.name === "Sample - Superstore");const logicalTables = await dataSource.getLogicalTablesAsync()const dataTable = await dataSource.getLogicalTableDataAsync(logicalTables[0].id);console.log(dataTable);
    ```
    
    - Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:156

### getLogicalTablesAsync[](#getlogicaltablesasync)

- getLogicalTablesAsync(): Promise<[LogicalTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/LogicalTable.html)\[\]\>[](#getlogicaltablesasync-1)
    
    Gets the underlying logical tables used in the data source.
    
    #### Returns Promise<[LogicalTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/LogicalTable.html)\[\]\>
    
    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);  });});
    ```
    
    - Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:129

### getUnderlyingDataAsync[](#getunderlyingdataasync)

- getUnderlyingDataAsync(  
        options?: [DataSourceUnderlyingDataOptions](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataSourceUnderlyingDataOptions.html),  
    ): Promise<[DataTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataTable.html)\>[](#getunderlyingdataasync-1)
    
    #### Parameters
    
    - `Optional`options: [DataSourceUnderlyingDataOptions](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataSourceUnderlyingDataOptions.html)
        
        Collection of options to change the behavior of the call.
    
    #### Returns Promise<[DataTable](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/DataTable.html)\>
    
    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);
    ```
    
    #### Deprecated[](#deprecated-1)
    
    Use DataSource.getLogicalTableDataReaderAsync or DataSource.getLogicalTableDataAsync.
    
    - Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:108

### refreshAsync[](#refreshasync)

- refreshAsync(): Promise<void\>[](#refreshasync-1)
    
    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.
    
    #### Returns Promise<void\>
    
    Promise that resolves when the data source has finished refreshing.
    
    - Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:70

## Properties

### `Readonly`extractUpdateTime[](#extractupdatetime)

extractUpdateTime: undefined | string

#### Returns[](#returns)

Last update time of the data source's extract, or undefined if this data source is live.

- Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:35

### `Readonly`fields[](#fields)

fields: [Field](https://help.tableau.com/v0.0/api/embedding_api/en-us/reference/interfaces/Field.html)\[\]

#### Returns[](#returns-1)

An array of fields associated with this data source.

- Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:30

### `Readonly`id[](#id)

id: string

#### Returns[](#returns-2)

Unique string representing this data source.

- Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:25

### `Readonly`isExtract[](#isextract)

isExtract: boolean

#### Returns[](#returns-3)

True if this data source is an extract, false otherwise.

- Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:40

### `Readonly`isPublished[](#ispublished)

isPublished: undefined | boolean

#### Returns[](#returns-4)

True if this data source is published to server, false otherwise. Always undefined prior to Tableau 2021.4.

- Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:46

### `Readonly`name[](#name)

name: string

#### Returns[](#returns-5)

The user friendly name of the data source as seen in the UI.

- Defined in packages/api-external-contract-js/src/ExternalContract/Shared/DataSourceInterfaces.ts:20

### Settings

Member Visibility

- Protected
- Inherited
- External

ThemeOSLightDark

### On This Page

Methods

[getActiveTablesAsync](#getactivetablesasync)[getConnectionSummariesAsync](#getconnectionsummariesasync)[getLogicalTableDataAsync](#getlogicaltabledataasync)[getLogicalTablesAsync](#getlogicaltablesasync)[getUnderlyingDataAsync](#getunderlyingdataasync)[refreshAsync](#refreshasync)

Properties

[extractUpdateTime](#extractupdatetime)[fields](#fields)[id](#id)[isExtract](#isextract)[isPublished](#ispublished)[name](#name)