如何下载以前保存的Google Apps脚本修订版? [英] How do I download previous saved revisions of a Google Apps Script?

查看:76
本文介绍了如何下载以前保存的Google Apps脚本修订版?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然尝试从并选择v1

  • 在新脚本中添加一些使用库的代码

  • 使用脚本编辑器调试器进入库,您应该看到正确版本的代码



  • 例如,如果您的库被调用像MyOldCode这样的代码,在你的新脚本中包含一些如下代码:

      function getOldCode(){
    var一个= MyOldCode.anExampleFunction()
    }

    在var a行放置一个断点,用调试器运行getOldCode(),然后进入一个示例函数()。这将打开一个旧代码的文件,允许您复制并粘贴到其他地方。



    然后您可以拼凑v1。


    I am still attempting to recover from somehow 'loosing' a Google Apps Script when I created a copy of the script to fork the code to another project... My thought was to attempt to download older revisions of the Google Apps Script via the drive API, but this page indicates that perhaps it is not possible.

    Actions such as versioning, publishing or executing the script are not available through the API.

    So I attempted it anyway and alas this error occurs...

    <HttpError 400 when requesting 
    https://www.googleapis.com/drive/v2/files/..snipped../revisions?alt=json
    returned "File does not support revisions">
    

    So is there no mechanism to download previous versions or "Revisions" of Google Apps Script? What I would love is to get access to 'Revision 1' shown here within the script.google.com interface:

    解决方案

    This is a bit manual but:

    • Create another script project
    • Include your original script as a library in your new script and select v1
    • In the new script add some code that uses your "library"
    • Use the script editor debugger to step into the library and you should see the code from the correct version

    For example if your library is called something like "MyOldCode", include some code like this in your new script:

    function getOldCode() {
      var a = MyOldCode.anExampleFunction()
    }
    

    Put a breakpoint on the "var a" line, run getOldCode() with the debugger and then step into anExampleFunction(). This will open up one file of your old code allowing you to copy and paste it elsewhere.

    You can then piece together v1.

    这篇关于如何下载以前保存的Google Apps脚本修订版?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆