Google is committed to advancing racial equity for Black communities. See how.

Class DataSourceSpec

DataSourceSpec

Access the general settings of an existing data source spec. To access data source spec for certain type, use as...() method. To create a new data source spec, use SpreadsheetApp.newDataSourceSpec().

This example shows how to get information from a BigQuery data source spec.

var dataSourceTable =
    SpreadsheetApp.getActive().getSheetByName("Data Sheet 1").getDataSourceTables()[0];
var spec = dataSourceTable.getDataSource().getSpec();
if (spec.getType() == SpreadsheetApp.DataSourceType.BIGQUERY) {
  var bqSpec = spec.asBigQuery();
  Logger.log("Project ID: %s\n", bqSpec.getProjectId());
  Logger.log("Raw query string: %s\n", bqSpec.getRawQuery());
}

Methods

MethodReturn typeBrief description
asBigQuery()BigQueryDataSourceSpecGets the spec for BigQuery data source.
copy()DataSourceSpecBuilderCreates a DataSourceSpecBuilder based on this data source's settings.
getParameters()DataSourceParameter[]Gets the parameters of the data source.
getType()DataSourceTypeGets the type of the data source.

Detailed documentation

asBigQuery()

Gets the spec for BigQuery data source.

Return

BigQueryDataSourceSpec — The BigQuery data source spec.


copy()

Creates a DataSourceSpecBuilder based on this data source's settings.

Return

DataSourceSpecBuilder — The builder.


getParameters()

Gets the parameters of the data source.

Return

DataSourceParameter[] — The parameter list.


getType()

Gets the type of the data source.

Return

DataSourceType — The data source type.