Skip to content Skip to sidebar Skip to footer

I Am Trying To Pass A Variable From My Google Script Through To Htmloutputfromfile

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 store the HtmlS

Solution 1:

Issue:

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

Answer :

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

Snippet:

var monthBox = HtmlService.createTemplateFromFile('Month Box');//Type: HtmlTemplate
monthBox.mList = sNamesArray;

monthBox = monthBox.evaluate()    //Type: HtmlOutput after evaluation
    .setSandboxMode(HtmlService.SandboxMode.IFRAME)
    .setWidth(250)
    .setHeight(50);

monthbox = monthbox.getContent();

References:


Post a Comment for "I Am Trying To Pass A Variable From My Google Script Through To Htmloutputfromfile"