Google apps script 使用HtmlService HtmlTemplate时设置Google应用程序脚本showModalDialog的高度

Google apps script 使用HtmlService HtmlTemplate时设置Google应用程序脚本showModalDialog的高度,google-apps-script,Google Apps Script,我目前正在将使用不推荐的UI服务的Google应用程序脚本改为HtmlService 我使用以下代码(在电子表格容器绑定脚本中)创建了一个模式对话: var htmlTemplate=HtmlService.createTemplateFromFile('testDialogue'); htmlTemplate=template.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME); SpreadsheetApp.getUi().sh

我目前正在将使用不推荐的UI服务的Google应用程序脚本改为HtmlService

我使用以下代码(在电子表格容器绑定脚本中)创建了一个模式对话:

var htmlTemplate=HtmlService.createTemplateFromFile('testDialogue');
htmlTemplate=template.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
SpreadsheetApp.getUi().showModalDialog(htmlTemplate,“测试对话”);
对话框将打开,但我需要修改其尺寸

HtmlOutput对象有一个,但似乎没有相同的方法可用于

我尝试在对象上使用该方法,如下所示:

var htmlTemplate=HtmlService.createTemplateFromFile('testDialogue').setHeight(300);
但这就产生了这个错误:

TypeError:在对象HtmlTemplate中找不到函数setHeight

此外,我还检查了,但它们似乎都没有设置HtmlTemplate对象高度的方法。

在将.setHeight()方法链接到.evaulate()方法之后时,可以使用.setHeight()方法,如下所示:

template=template.evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.设置高度(300);

更新2/19/19:方法
.setSandboxMode()
不再有效-现在所有脚本都使用IFRAME模式,无论设置了什么沙盒模式()。该方法与设置高度无关,但我想我会提到这一点,以防有人最终复制和粘贴此代码示例。

如果沙盒“不再”有效,是否有IFRAME示例?@aNewb不再需要
setSandboxMode()
方法。因此,工作语句应该是:
template=template.evaluate().setHeight(300)