I am trying to pass a variable from my Google Script through to HtmlOutputFromFile

前端 未结 1 494
轮回少年
轮回少年 2020-12-22 05:51

I am trying to create an input box with a drop down list, where that list is based on a 2D array pulled from a Spreadsheet.

My research so far has told me that if i

相关标签:
1条回答
  • 2020-12-22 06:13

    Issue:

    • Attempting to modify the HtmlOutput object instead of modifying HtmlTemplate object.

    Solution:

    • Only the html template can be modified with variables. Modify the template and evaluate it to return HtmlOutput

    Snippet:

    var monthBox = HtmlService.createHtmlTemplateFromFile('Month Box');//Type: HtmlTemplate
    monthBox.mList = sNamesArray;
    
    monthBox = monthBox.evalate()    //Type: HtmlOutput after evaluation
        .setSandboxMode(HtmlService.SandboxMode.IFRAME)
        .setWidth(250)
        .setHeight(50);
    

    References:

    • HtmlTemplate
    • HtmlOutput
    0 讨论(0)
提交回复
热议问题