【发布时间】:2017-11-03 07:47:45
【问题描述】:
我的脚本对象是在电子表格中打开一个 Html 窗口并选择任何按钮,然后在脚本应该运行后一旦单击特定按钮。
除了一个额外的步骤,我的脚本执行所有操作,每次我进行选择时它都会打开一个空白窗口。
这是我的 HTML 代码:-
<script>
window.addEventListener('load', displayButtons());
function displayButtons(){
document.getElementById("myForm").innerHTML+='<button style="margin-right:4px;" onclick="google.script.run.withSuccessHandler(google.script.host.close).FULLFEED();">FULL FEED</button>';
document.getElementById("myForm").innerHTML+='<button style="margin-right:4px;" onclick="google.script.run.withSuccessHandler(google.script.host.close).AIU();">Automatic Item Update</button>';
document.getElementById("myForm").innerHTML+='<button style="margin-right:4px;" onclick="google.script.run.withSuccessHandler(google.script.host.close).TOPSKU();">TOP SKU</button>';
document.getElementById("myForm").innerHTML+='<button style="margin-right:4px;" onclick="google.script.run.withSuccessHandler(google.script.host.close).LIA();">LIA</button>';
document.getElementById("myForm").innerHTML+='<button style="margin-right:4px;" onclick="google.script.run.withSuccessHandler(google.script.host.close).QA();">Quality Analysis</button>';
}
</script>
这是我的应用程序脚本:-
function Popup() {
var html = HtmlService.createHtmlOutputFromFile('Index5');
SpreadsheetApp.getUi()
.showModalDialog(html, 'Select Procedure');
var ss = SpreadsheetApp.getActiveSpreadsheet();
html.setHeight(600).setWidth(288);
ss.show(html);
}
function FULLFEED()
{ Zoom(); }
function AIU()
{ AIURUN(); }
function TOPSKU()
{ TOPSKURUN(); }
function LIA()
{ LIARUN(); }
function QA()
{ QARUN(); }
如果我做出任何选择,请告诉我为什么会弹出一个奇怪的空白浏览器窗口,仅供参考,我的功能运行良好。
【问题讨论】:
-
这里应该做的是link到你想看的电子表格。
标签: html google-apps-script google-sheets