Google Apps Script - Javascript not working

后端 未结 2 1202
灰色年华
灰色年华 2021-01-28 12:26

I created a simple web app, and it is not working.

Code.gs:

function doGet() {//I think this works
  var output = HtmlService.createTemplateFromFile(\'in         


        
2条回答
  •  灰色年华
    2021-01-28 12:44

    A Simple HTML dialog example

    I usually test these things as a dialog to get them working. It's works as a dialog and I've also included the doGet. I hope this helps. I didn't go exactly as you were going but I think this will help you move that way.

    Code.gs:

    function doGet() 
    {
      var output = HtmlService.createTemplateFromFile('webappdoesnotwork');
      return output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
    }
    
    function getEmail(email) 
    {
      Logger.log(email);
      return true;
    }
    
    function showDialog()
    {
      var output = HtmlService.createHtmlOutputFromFile('webappdoesnotwork');
      SpreadsheetApp.getUi().showModelessDialog(output, 'My WebApp');
    }
    

    webappdoesnotwork.html

    
        
          
          
          
          
          
            
            

提交回复
热议问题