Google Apps Script to open a URL

后端 未结 5 562
梦谈多话
梦谈多话 2020-11-22 10:39

Is there a way to write a google apps script so when ran, a second browser window opens to www.google.com (or another site of my choice)?

I am trying to come up with

5条回答
  •  执笔经年
    2020-11-22 11:12

    Building of off an earlier example, I think there is a cleaner way of doing this. Create an index.html file in your project and using Stephen's code from above, just convert it into an HTML doc.

    
    
      
      
      
        

    Then, in your Code.gs script, you can have something like the following,

    function getUrl() {
      return 'http://whatever.com';
    }
    
    function openUrl() {
      var html = HtmlService.createHtmlOutputFromFile("index");
      html.setWidth(90).setHeight(1);
      var ui = SpreadsheetApp.getUi().showModalDialog(html, "Opening ..." );
    }
    

提交回复
热议问题