【问题标题】:How can I save the output on refresh : google Appscript如何在刷新时保存输出:google Appscript
【发布时间】:2021-04-08 05:55:01
【问题描述】:

我有一个要求,刷新时数据应保持与我们从电子表格调用的相同(电子表格中的数据可能会更改,因为用户对其数据的视图不应更改) 用户首先输入他的值,该值提交到电子表格,其中有一些公式计算数据并在 webapp 中给出输出。

因此,如果任何其他用户同时提交输入(来自 webapp),那么它可能会更改第一个用户的输出,因此我们必须将第一个用户的输出保存在另一个可以用作数据库的工作表中.但是如何调用数据库中的值,并且 URL 应该与时间戳等唯一值保持相同?

【问题讨论】:

    标签: javascript html google-apps-script


    【解决方案1】:

    为了让你的 webapp 更新,你应该在 JS 文件中添加一个自动刷新功能。

    例子:

    
      function auto_check() {
        google.script.run.withSuccessHandler(putData).askData();
        window.setTimeout(auto_check, 3000); // every 3sec
      }
    
      //function with returning values to update the webapp
      function putData(e) {
        $('#elem_to_update').html(e.new_value);
      }
    
      //in order to start the autocheck as soon as loaded
      window.onload = function () {
        auto_check();
      }
    
    

    如果这不是您需要的结果,请提供您的问题的更多信息

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-21
      • 2012-07-16
      • 2015-05-19
      • 1970-01-01
      • 2012-12-19
      • 2021-02-18
      相关资源
      最近更新 更多