The builder for DataSourceSpec
. To create a specification for certain type, use as...()
method. To create a new builder, use SpreadsheetApp.newDataSourceSpec()
. To use the specification, see DataSourceTable
.
Only use this class with data that's connected to a database.
This examples show how to build a BigQuery data source specification.
var spec = SpreadsheetApp.newDataSourceSpec() .asBigQuery() .setProjectId('big_query_project') .setRawQuery('select @FIELD from table limit @LIMIT') .setParameterFromCell('FIELD', 'Sheet1!A1') .setParameterFromCell('LIMIT', 'namedRangeCell') .build();
Methods
Method | Return type | Brief description |
---|---|---|
asBigQuery() | BigQueryDataSourceSpecBuilder | Gets the builder for BigQuery data source. |
build() | DataSourceSpec | Builds a data source specification from the settings in this builder. |
copy() | DataSourceSpecBuilder | Creates a DataSourceSpecBuilder based on this data source's settings. |
getParameters() | DataSourceParameter[] | Gets the parameters of the data source. |
getType() | DataSourceType | Gets the type of the data source. |
removeAllParameters() | DataSourceSpecBuilder | Removes all the parameters. |
removeParameter(parameterName) | DataSourceSpecBuilder | Removes the specified parameter. |
setParameterFromCell(parameterName, sourceCell) | DataSourceSpecBuilder | Adds a parameter, or if the parameter with the name exists, updates its source cell. |
Detailed documentation
asBigQuery()
Gets the builder for BigQuery data source.
Return
BigQueryDataSourceSpecBuilder
— The BigQuery data source specification builder.
build()
Builds a data source specification from the settings in this builder. Must use as...()
to specify a data source type before building.
Return
DataSourceSpec
— The data source specification.
copy()
Creates a DataSourceSpecBuilder
based on this data source's settings.
Return
DataSourceSpecBuilder
— The builder.
getParameters()
getType()
removeAllParameters()
removeParameter(parameterName)
Removes the specified parameter.
Parameters
Name | Type | Description |
---|---|---|
parameterName | String | The name of the parameter to remove. |
Return
DataSourceSpecBuilder
— The builder, for chaining.
setParameterFromCell(parameterName, sourceCell)
Adds a parameter, or if the parameter with the name exists, updates its source cell.
Parameters
Name | Type | Description |
---|---|---|
parameterName | String | The parameter name. |
sourceCell | String | The source cell, as specified in A1 notation. |
Return
DataSourceSpecBuilder
— The builder, for chaining.