Class LookerDataSourceSpec Stay organized with collections Save and categorize content based on your preferences.
Page Summary
LookerDataSourceSpec is a DataSourceSpec used to access existing Looker data source specifications.
You can obtain a Looker data source specification from a sheet with a Looker connection using
getDataSources()andasLooker().The
copy()method creates a DataSourceSpecBuilder based on the current data source settings.Methods like
getExploreName(),getInstanceUrl(), andgetModelName()retrieve specific details about the Looker data source.getParameters()gets the data source parameters, which is only available for BigQuery data sources, andgetType()gets the data source type.
AData which is used to access specifically the existing Looker data sourcespecifications. To create a new data source specification, useSpreadsheet.
This example shows how you can get the Looker data source spec from a sheet which has just oneLooker connection.
// TODO(developer): Replace the URL with your own.constss=SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit',);constlookerDataSourceSpec=ss.getDataSources()[0].getSpec().asLooker();
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Data | Creates aData based on this data source's settings. |
get | String | Gets the name of the Looker explore in the model. |
get | String | Gets the URL of the Looker instance. |
get | String | Gets the name of the Looker model in the instance. |
get | Data | Gets the parameters of the data source. |
get | Data | Gets the type of the data source. |
Detailed documentation
copy()
Creates aData based on this data source's settings.
// TODO(developer): Replace the URL with your own.constss=SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit',);constspec=ss.getDataSources()[0].getSpec();constnewSpec=spec.copy();
Return
Data — The builder.
getExploreName()
Gets the name of the Looker explore in the model.
// TODO(developer): Replace the URL with your own.constss=SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit',);constlookerDataSourceSpec=ss.getDataSources()[0].getSpec().asLooker();constexploreName=lookerDataSourceSpec.getExploreName();Logger.log(exploreName);
Return
String — The name of the Looker explore.
getInstanceUrl()
Gets the URL of the Looker instance.
// TODO(developer): Replace the URL with your own.constss=SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit',);constlookerDataSourceSpec=ss.getDataSources()[0].getSpec().asLooker();constinstanceUrl=lookerDataSourceSpec.getInstanceUrl();Logger.log(instanceUrl);
Return
String — The URL of the Looker instance.
getModelName()
Gets the name of the Looker model in the instance.
// TODO(developer): Replace the URL with your own.constss=SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit',);constlookerDataSourceSpec=ss.getDataSources()[0].getSpec().asLooker();constmodelName=lookerDataSourceSpec.getModelName();Logger.log(modelName);
Return
String — The name of the Looker model.
getParameters()
Gets the parameters of the data source.
// TODO(developer): Replace the URL with your own.constss=SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit',);constspec=ss.getDataSources()[0].getSpec();constparameters=spec.getParameters();
This method is only available for BigQuery data sources.
Return
Data — The parameter list.
getType()
Gets the type of the data source.
// TODO(developer): Replace the URL with your own.constss=SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit',);constspec=ss.getDataSources()[0].getSpec();consttype=spec.getType();
Return
Data — The data source type.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.