Stay organized with collections Save and categorize content based on your preferences.
Detailed documentationbuild()
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.
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.
const lookerDataSourceSpecBuilder = SpreadsheetApp.newDataSourceSpec().asLooker(); const lookerSpec = lookerDataSourceSpecBuilder.setExploreName('my explore name') .setInstanceUrl('my instance url') .setModelName('my model name') .build();Return
DataSourceSpec
— The data source specification.
copy()
Creates a DataSourceSpecBuilder
based on this data source's settings.
// 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
DataSourceSpecBuilder
— The builder.
getDatasetId()
Gets the BigQuery dataset ID.
ReturnString
— 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.
// 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.
ReturnDataSourceParameter[]
— The parameter list.
getProjectId()
Gets the billing project ID.
ReturnString
— The project ID.
getRawQuery()
Gets the raw query string.
ReturnString
— The raw query string.
getTableId()
Gets the BigQuery table ID.
ReturnString
— 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.
ReturnString
— 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.
// 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
DataSourceType
— The data source type.
removeAllParameters()
Removes all the parameters.
const specBuilder = SpreadsheetApp.newDataSourceSpec(); specBuilder.removeAllParameters();Return
BigQueryDataSourceSpecBuilder
— The builder, for chaining.
removeParameter(parameterName)
Removes the specified parameter.
const specBuilder = SpreadsheetApp.newDataSourceSpec(); specBuilder.removeParameter('x');Parameters Name Type Description
parameterName
String
The name of the parameter to remove. Return
BigQueryDataSourceSpecBuilder
— The builder, for chaining.
setDatasetId(datasetId)
Sets the BigQuery dataset ID.
Parameters Name Type DescriptiondatasetId
String
The ID of the dataset. Return
BigQueryDataSourceSpecBuilder
— 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 DataSourceType.BIGQUERY
.
This method is only available for BigQuery data sources.
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
BigQueryDataSourceSpecBuilder
— The builder, for chaining.
setProjectId(projectId)
Sets the billing BigQuery project ID.
Parameters Name Type DescriptionprojectId
String
The ID of the billing project. Return
BigQueryDataSourceSpecBuilder
— The builder, for chaining.
setRawQuery(rawQuery)
Sets the raw query string.
Parameters Name Type DescriptionrawQuery
String
The raw query string. Return
BigQueryDataSourceSpecBuilder
— The builder, for chaining.
setTableId(tableId)
Sets the BigQuery table ID.
Parameters Name Type DescriptiontableId
String
The ID of the table. Return
BigQueryDataSourceSpecBuilder
— This builder, for chaining.
setTableProjectId(projectId)
Sets the BigQuery project ID for the table.
Parameters Name Type DescriptionprojectId
String
The project ID of the BigQuery table. Return
BigQueryDataSourceSpecBuilder
— The builder, for chaining.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-03 UTC."],[[["`BigQueryDataSourceSpecBuilder` helps construct specifications for BigQuery data sources in Google Sheets."],["It offers methods to set the dataset ID, project ID, table ID, and raw query for the data source."],["Parameters can be defined and linked to specific cells within the spreadsheet."],["The builder can be used to create or copy data source specifications for use with connected sheets."],["After configuring the data source details, the `build()` method finalizes the specification."]]],["The `BigQueryDataSourceSpecBuilder` constructs data source specifications. Key actions include: building a data source spec using `build()`, copying settings via `copy()`, and managing data source parameters through `getParameters()`, `removeAllParameters()`, `removeParameter()`, and `setParameterFromCell()`. Information setting/getting methods are available such as: `set/getDatasetId()`, `set/getProjectId()`, `set/getRawQuery()`, `set/getTableId()`, `set/getTableProjectId()`, and `getType()`. These allow you to configure the BigQuery dataset, project, table, and raw query details.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4