简体   繁体   English

"如何在谷歌应用脚​​本函数中使用模态表单数据?"

[英]How to use the modal form data in the google apps script functions?

So, I got a google apps script, which collect the content from the user selected range and also from the form data opened in the modal.所以,我得到了一个谷歌应用程序脚本,它从用户选择的范围以及在模式中打开的表单数据中收集内容。

The script is run when I use a menu button in my spreadsheet, but after like 2 or 3 seconds, I get "Script finished" and then the modal opens.当我在电子表格中使用菜单按钮时,脚本会运行,但大约 2 或 3 秒后,我得到“脚本完成”,然后模式打开。 With the script finished, I can't handle the data from the modal.脚本完成后,我无法处理来自模态的数据。 How to do that?怎么做?

This is a piece of the code: main.gs:这是一段代码:main.gs:

function main() {
  showForm();
}

Try尝试

in html在 HTML 中

  function getData() {
    var data = document.forms[0]
    var tab = []
    for (var i=0;i<data.length;i++){
    if (data[i].type != "button"){
        tab.push(data[i].value)
      }
    }
    google.script.run.saveData(tab);
    // document.forms[0].reset()
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM