Özellikle mevcut Looker veri kaynağı özelliklerine erişmek için kullanılan bir Data. Yeni bir veri kaynağı spesifikasyonu oluşturmak için Spreadsheet öğesini kullanın.
Bu örnekte, yalnızca bir Looker bağlantısı olan bir sayfadan Looker veri kaynağı spesifikasyonunu nasıl alabileceğiniz gösterilmektedir.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker();
Yöntemler
| Yöntem | Dönüş türü | Kısa açıklama |
|---|---|---|
copy() | Data | Bu veri kaynağının ayarlarına göre bir Data oluşturur. |
get | String | Modeldeki Looker keşfinin adını alır. |
get | String | Looker örneğinin URL'sini alır. |
get | String | Örnekteki Looker modelinin adını alır. |
get | Data | Veri kaynağının parametrelerini alır. |
get | Data | Veri kaynağının türünü alır. |
Ayrıntılı dokümanlar
copy()
Bu veri kaynağının ayarlarına göre bir Data oluşturur.
// 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
Data: Oluşturucu.
get Explore Name()
Modeldeki Looker keşfinin adını alır.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker(); const exploreName = lookerDataSourceSpec.getExploreName(); Logger.log(exploreName);
Return
String: Looker keşfinin adı.
get Instance Url()
Looker örneğinin URL'sini alır.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker(); const instanceUrl = lookerDataSourceSpec.getInstanceUrl(); Logger.log(instanceUrl);
Return
String: Looker örneğinin URL'si.
get Model Name()
Örnekteki Looker modelinin adını alır.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker(); const modelName = lookerDataSourceSpec.getModelName(); Logger.log(modelName);
Return
String: Looker modelinin adı.
get Parameters()
Veri kaynağının parametrelerini alır.
// 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();
Bu yöntem yalnızca BigQuery veri kaynakları için kullanılabilir.
Return
Data: Parametre listesi.
get Type()
Veri kaynağının türünü alır.
// 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
Data: Veri kaynağı türü.