Оптимизируйте свои подборки Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Спецификация источника данных Looker
Data Source Spec , которая используется для доступа конкретно к существующим спецификациям источников данных Looker. Чтобы создать новую спецификацию источника данных, используйте Spreadsheet App.newDataSourceSpec() .
В этом примере показано, как получить спецификацию источника данных Looker из листа, который имеет только одно подключение к Looker.
// 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();
// 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();
// 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);
Возвращаться
String — имя исследования Looker.
get Instance Url()
Получает URL-адрес экземпляра Looker.
// 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);
Возвращаться
String — URL-адрес экземпляра Looker.
get Model Name()
Получает имя модели Looker в экземпляре.
// 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);
Возвращаться
String — имя модели Looker.
get Parameters()
Получает параметры источника данных.
// 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();
Этот метод доступен только для источников данных BigQuery.
// 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();
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003e\u003ccode\u003eLookerDataSourceSpec\u003c/code\u003e enables access to existing Looker data source specifications within Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eTo create new data source specifications, use \u003ccode\u003eSpreadsheetApp.newDataSourceSpec()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve details such as explore name, instance URL, and model name from a \u003ccode\u003eLookerDataSourceSpec\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eSeveral methods, including \u003ccode\u003ecopy()\u003c/code\u003e, \u003ccode\u003egetExploreName()\u003c/code\u003e, \u003ccode\u003egetInstanceUrl()\u003c/code\u003e, \u003ccode\u003egetModelName()\u003c/code\u003e, \u003ccode\u003egetParameters()\u003c/code\u003e, and \u003ccode\u003egetType()\u003c/code\u003e, are available for interacting with Looker data source specifications.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetParameters()\u003c/code\u003e method is specific to BigQuery data sources and retrieves their parameters.\u003c/p\u003e\n"]]],["The `LookerDataSourceSpec` accesses existing Looker data sources. Key actions include retrieving data source details via methods: `getExploreName()` gets the Looker explore name, `getInstanceUrl()` gets the Looker instance URL, and `getModelName()` gets the Looker model name. `getParameters()` retrieves data source parameters (available only for BigQuery), and `getType()` gets the data source type. The `copy()` method creates a `DataSourceSpecBuilder` based on current settings. You can retrieve the looker data source by using `getDataSources()[0].getSpec().asLooker()`.\n"],null,["LookerDataSourceSpec\n\nA [DataSourceSpec](/apps-script/reference/spreadsheet/data-source-spec) which is used to access specifically the existing Looker data source\nspecifications. To create a new data source specification, use [SpreadsheetApp.newDataSourceSpec()](/apps-script/reference/spreadsheet/spreadsheet-app#newDataSourceSpec()).\n\nThis example shows how you can get the Looker data source spec from a sheet which has just one\nLooker connection.\n\n```javascript\n// TODO(developer): Replace the URL with your own.\nconst ss = SpreadsheetApp.openByUrl(\n 'https://docs.google.com/spreadsheets/d/abc123456/edit',\n);\n\nconst lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker();\n``` \n\nMethods\n\n| Method | Return type | Brief description |\n|---------------------------------------|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| [copy()](#copy()) | [DataSourceSpecBuilder](/apps-script/reference/spreadsheet/data-source-spec-builder) | Creates a [DataSourceSpecBuilder](/apps-script/reference/spreadsheet/data-source-spec-builder) based on this data source's settings. |\n| [getExploreName()](#getExploreName()) | `String` | Gets the name of the Looker explore in the model. |\n| [getInstanceUrl()](#getInstanceUrl()) | `String` | Gets the URL of the Looker instance. |\n| [getModelName()](#getModelName()) | `String` | Gets the name of the Looker model in the instance. |\n| [getParameters()](#getParameters()) | [DataSourceParameter[]](/apps-script/reference/spreadsheet/data-source-parameter) | Gets the parameters of the data source. |\n| [getType()](#getType()) | [DataSourceType](/apps-script/reference/spreadsheet/data-source-type) | Gets the type of the data source. |\n\nDetailed documentation \n\n`copy()` \nCreates a [DataSourceSpecBuilder](/apps-script/reference/spreadsheet/data-source-spec-builder) based on this data source's settings.\n\n```javascript\n// TODO(developer): Replace the URL with your own.\nconst ss = SpreadsheetApp.openByUrl(\n 'https://docs.google.com/spreadsheets/d/abc123456/edit',\n);\nconst spec = ss.getDataSources()[0].getSpec();\n\nconst newSpec = spec.copy();\n```\n\nReturn\n\n\n[DataSourceSpecBuilder](/apps-script/reference/spreadsheet/data-source-spec-builder) --- The builder.\n\n*** ** * ** ***\n\n`get``Explore``Name()` \nGets the name of the Looker explore in the model.\n\n```javascript\n// TODO(developer): Replace the URL with your own.\nconst ss = SpreadsheetApp.openByUrl(\n 'https://docs.google.com/spreadsheets/d/abc123456/edit',\n);\n\nconst lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker();\nconst exploreName = lookerDataSourceSpec.getExploreName();\nLogger.log(exploreName);\n```\n\nReturn\n\n\n`String` --- The name of the Looker explore.\n\n*** ** * ** ***\n\n`get``Instance``Url()` \nGets the URL of the Looker instance.\n\n```javascript\n// TODO(developer): Replace the URL with your own.\nconst ss = SpreadsheetApp.openByUrl(\n 'https://docs.google.com/spreadsheets/d/abc123456/edit',\n);\n\nconst lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker();\nconst instanceUrl = lookerDataSourceSpec.getInstanceUrl();\nLogger.log(instanceUrl);\n```\n\nReturn\n\n\n`String` --- The URL of the Looker instance.\n\n*** ** * ** ***\n\n`get``Model``Name()` \nGets the name of the Looker model in the instance.\n\n```javascript\n// TODO(developer): Replace the URL with your own.\nconst ss = SpreadsheetApp.openByUrl(\n 'https://docs.google.com/spreadsheets/d/abc123456/edit',\n);\n\nconst lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker();\nconst modelName = lookerDataSourceSpec.getModelName();\nLogger.log(modelName);\n```\n\nReturn\n\n\n`String` --- The name of the Looker model.\n\n*** ** * ** ***\n\n`get``Parameters()` \nGets the parameters of the data source.\n\n```javascript\n// TODO(developer): Replace the URL with your own.\nconst ss = SpreadsheetApp.openByUrl(\n 'https://docs.google.com/spreadsheets/d/abc123456/edit',\n);\nconst spec = ss.getDataSources()[0].getSpec();\nconst parameters = spec.getParameters();\n```\n\nThis method is only available for BigQuery data sources.\n\nReturn\n\n\n[DataSourceParameter[]](/apps-script/reference/spreadsheet/data-source-parameter) --- The parameter list.\n\n*** ** * ** ***\n\n`get``Type()` \nGets the type of the data source.\n\n```javascript\n// TODO(developer): Replace the URL with your own.\nconst ss = SpreadsheetApp.openByUrl(\n 'https://docs.google.com/spreadsheets/d/abc123456/edit',\n);\nconst spec = ss.getDataSources()[0].getSpec();\nconst type = spec.getType();\n```\n\nReturn\n\n\n[DataSourceType](/apps-script/reference/spreadsheet/data-source-type) --- The data source type."]]