google.script.host, etkileşime geçebilen, eşzamansız bir istemci taraflı JavaScript API'dir
  Google Dokümanlar, E-Tablolar veya Formlar'da
  HTML hizmeti sayfaları. Sunucu tarafı işlevlerini
  için google.script.run kullanın. Daha fazla bilgi için bkz.
  "the"
  sunucu işlevleriyle iletişim kurma kılavuzu
  inceleyebilirsiniz.
Özellikler
| Özellik | Açıklama | 
|---|---|
origin | Komut dosyalarının doğru şekilde kullanmalısınız. | 
Yöntemler
| Yöntem | Dönüş türü | Kısa açıklama | 
|---|---|---|
close() | 
  void | 
  Geçerli iletişim kutusunu veya kenar çubuğunu kapatır. | 
editor.focus() | 
  void | 
  İletişim kutusundaki veya kenar çubuğundaki tarayıcı odağını Google Dokümanlar, E-Tablolar veya Formlar düzenleyicisine geçirir. | 
setHeight(height) | 
  void | 
  Geçerli iletişim kutusunun yüksekliğini ayarlar. | 
setWidth(width) | 
  void | 
  Geçerli iletişim kutusunun genişliğini ayarlar. | 
Ayrıntılı belgeler
close()
Geçerli iletişim kutusunu veya kenar çubuğunu kapatır.
Code.gs
function onOpen(e) {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createMenu('Sidebar').addItem('Show', 'showSidebar').addToUi();
}
function showSidebar() {
  var html = HtmlService.createHtmlOutputFromFile('Index');
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showSidebar(html);
}Index.html
<input type="button" value="Close" onclick="google.script.host.close()" />
editor.focus()
İletişim kutusundaki veya kenar çubuğundaki tarayıcı odağını Google Dokümanlar, E-Tablolar veya Formlar düzenleyicisine geçirir.
Code.gs
function onOpen(e) {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createMenu('Sidebar').addItem('Show', 'showSidebar').addToUi();
}
function showSidebar() {
  var html = HtmlService.createHtmlOutputFromFile('Index');
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showSidebar(html);
}Index.html
<input type="button" value="Switch focus" onclick="google.script.host.editor.focus()" />
setHeight(height)
Geçerli iletişim kutusunun yüksekliğini ayarlar.
Code.gs
function onOpen(e) {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createMenu('Dialog').addItem('Show', 'showDialog').addToUi();
}
function showDialog() {
  var html = HtmlService.createHtmlOutputFromFile('Index')
      .setWidth(300)
      .setHeight(200);
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showModalDialog(html, 'Dialog title');
}Index.html
<script>
  function resizeDialog(width, height) {
    google.script.host.setWidth(width);
    google.script.host.setHeight(height);
  }
</script>
<input type="button" value="Resize dialog"
  onclick="resizeDialog(450, 300)" />Parametreler
| Ad | Tür | Açıklama | 
|---|---|---|
height | Integer | piksel cinsinden yeni yükseklik | 
setWidth(width)
Geçerli iletişim kutusunun genişliğini ayarlar.
Code.gs
function onOpen(e) {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createMenu('Dialog').addItem('Show', 'showDialog').addToUi();
}
function showDialog() {
  var html = HtmlService.createHtmlOutputFromFile('Index')
      .setWidth(300)
      .setHeight(200);
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showModalDialog(html, 'Dialog title');
}Index.html
<script>
  function resizeDialog(width, height) {
    google.script.host.setWidth(width);
    google.script.host.setHeight(height);
  }
</script>
<input type="button" value="Resize dialog"
  onclick="resizeDialog(450, 300)" />Parametreler
| Ad | Tür | Açıklama | 
|---|---|---|
width | Integer | piksel cinsinden yeni genişlik |