【问题标题】:Return id file from google picker when i'm make a google add-ons当我制作谷歌插件时,从谷歌选择器返回 id 文件
【发布时间】:2014-05-09 21:10:41
【问题描述】:

我是哥伦比亚人,我的英语不好,希望你能理解我的问题。 我正在谷歌文档(谷歌应用程序脚本)上设置谷歌插件,我正在调用谷歌选择器来选择文件,但我无法做到这一点,因为我不知道如何,当我单击选择将文件的 id 变量发送到其他文件到扩展名为 html 或 gs 的项目中。

请任何人帮助我。谢谢...

【问题讨论】:

    标签: google-apps-script google-docs google-picker


    【解决方案1】:

    没有看到你的代码很难说。如果您提供它应该会更容易回答这个问题。

    我建议使用 DriveApp 或 DocsList 服务来获取文档 ID。为此,您将执行以下操作:

    DriveApp:

    //the variable blob should be whatever you get from the file picker
    var file = DriveApp.createFile(blob);
    var fileId = file.getId();
    return fileId;
    

    文档列表:

    //the variable blob should be whatever you get from the file picker
    var file = DocsList.createFile(blob);
    var fileId = file.getId();
    return fileId;
    

    【讨论】:

      【解决方案2】:

      谢谢你的回答,我能做到,我只是使用了一个隐藏的输入并通过一个表单发送它,它看起来像 ->

      <form id="form1">
         <input type="hidden" id="idFile">
      </form>
      

      当我点击选择按钮选择器时,所以 ->

      google.script.run.processForm(document.forms[0]);
      

      函数“processForm”在扩展名为“gs”的文件中。

      我写这些信息是因为我想帮助任何有同样问题的人。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-12-15
        • 2020-03-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多