本文介绍了从另一个项目获取绑定脚本ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从另一个脚本(在另一个文件中)获取嵌入在电子表格中的脚本的ID(而不是电子表格的ID)?

Is there a way to get the id of a script embedded in a spreadsheet (not the id of the spreadsheet) from another script (in other file)?

我有一个主要的独立脚本,该脚本可以复制包含脚本的电子表格(Web应用程序代码).我需要获取此脚本的ID,并将其用于通过apps脚本API REST创建部署.

I have a main standalone script that copies a spreadsheet that contains a script (web app code). I need to get the id of this script and use it to create a deployment with the apps script API REST.

还有其他方法可以通过编程方式在电子表格中部署受限的Web应用程序脚本吗?

Is there any other way to programmatically deploy a bounded web app script in a spreadsheet?

为我的英语不好而道歉,我正在使用翻译器

Apologies for my bad English, I´m using the translator

推荐答案

为了实现Is there any other way to programmatically deploy a bounded web app script in a spreadsheet?,首先,需要检索容器绑定脚本的脚本ID.

In order to achieve Is there any other way to programmatically deploy a bounded web app script in a spreadsheet?, at first, it is required to retrieve the script ID of the container-bound script.

但是,不幸的是,在当前阶段,仍然不能仅使用Google Apps脚本从项目外部检索容器绑定脚本的脚本ID.而且,无法从父Google Docs文件的文件ID中检索与容器绑定的脚本的脚本ID.这已作为功能请求报告给Google问题跟踪器. 参考

But, unfortunately, in the current stage, the script ID of the container-bound script cannot still be retrieved from outside of the project using only Google Apps Script. And also, the the script ID of the container-bound script cannot be retrieved from the file ID of the parent Google Docs file. This has already been reported to the Google issue tracker as the Feature Request. Ref

当可以检索与容器绑定的脚本的脚本ID时,可以使用"REST资源:projects.deployments".在Apps Script API中.

When the script ID of the container-bound script can be retrieved, you can use "REST Resource: projects.deployments" in Apps Script API.

  • 如果用于检索脚本ID的脚本在同一项目中,则可以使用ScriptApp.getScriptId()检索脚本ID.
  • 可以使用方法:projects.get"方法从容器绑定脚本的脚本ID中检索Google Docs的文件ID.在Apps Script API中.但是在目前阶段,还不能做到相反.
  • If the script for retrieving the script ID is in the same project, the script ID can be retrieved using ScriptApp.getScriptId().
  • The file ID of Google Docs can be retrieved from the script ID of the container-bound script using the method of "Method: projects.get" in Apps Script API. But in the current stage, the contrary cannot be done.
  • getScriptId()
  • Method: projects.get
  • REST Resource: projects.deployments

这篇关于从另一个项目获取绑定脚本ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 14:18