google.script.host to asynchroniczny interfejs API JavaScript działający po stronie klienta, który może współdziałać
  z oknami lub paskami bocznymi w Dokumentach, Arkuszach lub Formularzach Google, które zawierają
  Strony usługi HTML. Do wykonywania funkcji po stronie serwera
  po stronie klienta, użyj google.script.run. Więcej informacji:
  
  przewodnik po komunikowaniu się z funkcjami serwera
  w usłudze HTML.
Właściwości
| Właściwość | Opis | 
|---|---|
origin | Udostępnia domenę hosta, dzięki czemu skrypty mogą w dodatku. | 
Metody
| Metoda | Zwracany typ | Krótki opis | 
|---|---|---|
close() | 
  void | 
  Zamyka bieżące okno lub pasek boczny. | 
editor.focus() | 
  void | 
  Przełącza zaznaczenie w przeglądarce z okna dialogowego lub paska bocznego na edytor Dokumentów, Arkuszy lub Formularzy Google. | 
setHeight(height) | 
  void | 
  Ustawia wysokość bieżącego okna. | 
setWidth(width) | 
  void | 
  Ustawia szerokość bieżącego okna. | 
Szczegółowa dokumentacja
close()
Zamyka bieżące okno lub pasek boczny.
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()
Przełącza zaznaczenie w przeglądarce z okna dialogowego lub paska bocznego na edytor Dokumentów, Arkuszy lub Formularzy Google.
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)
Ustawia wysokość bieżącego okna.
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)" />Parametry
| Nazwa | Typ | Opis | 
|---|---|---|
height | Integer | nowa wysokość w pikselach | 
setWidth(width)
Ustawia szerokość bieżącego okna.
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)" />Parametry
| Nazwa | Typ | Opis | 
|---|---|---|
width | Integer | nowa szerokość w pikselach. |