BigQueryDataSourceSpecBuilder

The builder for `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#`.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#build()` | `https://developers.google.com/apps-script/reference/spreadsheet/data-source-spec` | Builds a data source specification from the settings in this builder. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#copy()` | `https://developers.google.com/apps-script/reference/spreadsheet/data-source-spec-builder` | Creates a `https://developers.google.com/apps-script/reference/spreadsheet/data-source-spec-builder` based on this data source's settings. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#getDatasetId()` | `String` | Gets the BigQuery dataset ID. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#getParameters()` | `https://developers.google.com/apps-script/reference/spreadsheet/data-source-parameter` | Gets the parameters of the data source. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#getProjectId()` | `String` | Gets the billing project ID. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#getRawQuery()` | `String` | Gets the raw query string. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#getTableId()` | `String` | Gets the BigQuery table ID. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#getTableProjectId()` | `String` | Gets the BigQuery project ID for the table. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#getType()` | `https://developers.google.com/apps-script/reference/spreadsheet/data-source-type` | Gets the type of the data source. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#removeAllParameters()` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Removes all the parameters. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#removeParameter(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Removes the specified parameter. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#setDatasetId(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Sets the BigQuery dataset ID. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#setParameterFromCell(String,String)` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Adds a parameter, or if the parameter with the name exists, updates its source cell for data source spec builders of type `https://developers.google.com/apps-script/reference/spreadsheet/data-source-type#BIGQUERY`. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#setProjectId(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Sets the billing BigQuery project ID. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#setRawQuery(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Sets the raw query string. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#setTableId(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Sets the BigQuery table ID. |
| `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#setTableProjectId(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` | Sets the BigQuery project ID for the table. |

## Detailed documentation

### `build()`

Builds a data source specification from the settings in this builder. Must use `as...()`
to specify a data source type before building.

The following code sample builds a BigQuery DataSource Spec.

```javascript
const bigQueryDataSourceSpec = SpreadsheetApp.newDataSourceSpec().asBigQuery();
// TODO(developer): Replace with the required dataset, project and table IDs.
bigQueryDataSourceSpec.setDatasetId('my data set id');
bigQueryDataSourceSpec.setProjectId('my project id');
bigQueryDataSourceSpec.setTableId('my table id');

bigQueryDataSourceSpec.build();
```

The following code sample builds a Looker DataSource Spec.

```javascript
const lookerDataSourceSpecBuilder =
    SpreadsheetApp.newDataSourceSpec().asLooker();
const lookerSpec = lookerDataSourceSpecBuilder.setExploreName('my explore name')
                       .setInstanceUrl('my instance url')
                       .setModelName('my model name')
                       .build();
```

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/data-source-spec` --- The data source specification.

*** ** * ** ***

### `copy()`

Creates a `https://developers.google.com/apps-script/reference/spreadsheet/data-source-spec-builder` based on this data source's settings.

```javascript
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);
const spec = ss.getDataSources()[0].getSpec();

const newSpec = spec.copy();
```

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/data-source-spec-builder` --- The builder.

*** ** * ** ***

### `getDatasetId()`

Gets the BigQuery dataset ID.

#### Return


`String` --- The dataset ID, or an empty string if the data source spec is defined by a raw query.

*** ** * ** ***

### `getParameters()`

Gets the parameters of the data source.

```javascript
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);
const spec = ss.getDataSources()[0].getSpec();
const parameters = spec.getParameters();
```

This method is only available for BigQuery data sources.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/data-source-parameter` --- The parameter list.

*** ** * ** ***

### `getProjectId()`

Gets the billing project ID.

#### Return


`String` --- The project ID.

*** ** * ** ***

### `getRawQuery()`

Gets the raw query string.

#### Return


`String` --- The raw query string.

*** ** * ** ***

### `getTableId()`

Gets the BigQuery table ID.

#### Return


`String` --- The table ID, or an empty string if the data source spec is defined by a raw query.

*** ** * ** ***

### `getTableProjectId()`

Gets the BigQuery project ID for the table.

#### Return


`String` --- The table project ID, or an empty string if the data source spec is defined by a raw
query.

*** ** * ** ***

### `getType()`

Gets the type of the data source.

```javascript
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);
const spec = ss.getDataSources()[0].getSpec();
const type = spec.getType();
```

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/data-source-type` --- The data source type.

*** ** * ** ***

### `removeAllParameters()`

Removes all the parameters.

```javascript
const specBuilder = SpreadsheetApp.newDataSourceSpec();
specBuilder.removeAllParameters();
```

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- The builder, for chaining.

*** ** * ** ***

### `removeParameter(parameterName)`

Removes the specified parameter.

```javascript
const specBuilder = SpreadsheetApp.newDataSourceSpec();
specBuilder.removeParameter('x');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `parameterName` | `String` | The name of the parameter to remove. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- The builder, for chaining.

*** ** * ** ***

### `setDatasetId(datasetId)`

Sets the BigQuery dataset ID.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `datasetId` | `String` | The ID of the dataset. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- This builder, for chaining.

*** ** * ** ***

### `setParameterFromCell(parameterName, sourceCell)`

Adds a parameter, or if the parameter with the name exists, updates its source cell for data
source spec builders of type `https://developers.google.com/apps-script/reference/spreadsheet/data-source-type#BIGQUERY`.

This method is only available for BigQuery data sources.

```javascript
const specBuilder = SpreadsheetApp.newDataSourceSpec().asBigQuery();
specBuilder.setParameterFromCell('x', 'A1');
const bigQuerySpec = specBuilder.build();
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `parameterName` | `String` | The parameter name. |
| `sourceCell` | `String` | The source cell, as specified in A1 notation. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- The builder, for chaining.

*** ** * ** ***

### `setProjectId(projectId)`

Sets the billing BigQuery project ID.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `projectId` | `String` | The ID of the billing project. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- The builder, for chaining.

*** ** * ** ***

### `setRawQuery(rawQuery)`

Sets the raw query string.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `rawQuery` | `String` | The raw query string. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- The builder, for chaining.

*** ** * ** ***

### `setTableId(tableId)`

Sets the BigQuery table ID.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `tableId` | `String` | The ID of the table. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- This builder, for chaining.

*** ** * ** ***

### `setTableProjectId(projectId)`

Sets the BigQuery project ID for the table.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `projectId` | `String` | The project ID of the BigQuery table. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/big-query-data-source-spec-builder#` --- The builder, for chaining.