【问题标题】:How to show the Load Indicator while running the google app script如何在运行谷歌应用脚​​本时显示负载指示器
【发布时间】:2019-12-02 22:53:29
【问题描述】:

enter image description here

如何在运行 google app 脚本时显示负载指示器

【问题讨论】:

    标签: google-apps-script google-sheets-macros


    【解决方案1】:

    如果您想在图像显示和执行时停止与工作表的交互,您可以尝试使用UI 方法showModalDialog()。

    所以这样的事情可以解决你想要实现的目标:

    function showDialog() {
    
      var ui = SpreadsheetApp.getUi();
      // Display a modal dialog box with custom HtmlService content.
      var htmlOutput = HtmlService
        .createHtmlOutput('<img src=https://i.stack.imgur.com/AuqJU.gif>')
        .setWidth(250)
        .setHeight(300);
      ui.showModalDialog(htmlOutput, 'Script Running');
    
    
    }
    

    如果您想更好地控制对话框的关闭,您需要从客户端执行此操作。修改 showModalDialog() 内的 HTML 对象。如果您对此感兴趣,我建议您查看this question。

    您还可以查看有关 dialogs and other UI elements 的 Apps 脚本文档。

    【讨论】:

    • 嗨 Raserhin,感谢您的支持,我应用了上面的代码,但它显示给唯一运行脚本的用户。
    • 嗨 Raserhin,感谢您的支持,我应用了上面的代码,但它显示给唯一运行脚本的用户。在这里,我将告诉您我正在实现什么脚本正在运行基于触发器的时间。如果脚本运行它应该显示导入范围,直到脚本成功运行。这适用于查看电子表格的所有用户,也适用于查看访问用户。用户不应该有关闭加载 gif 的选项。
    • 您无法删除对话框的关闭选项。您可以尝试调用工作表对象的protect 方法。完成脚本后,您可以在Protection 对象中使用remove 方法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-12
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多