是否可以从其他脚本读取Google Apps脚本的内容 [英] Is it possible to read the contents of a Google Apps Script from another Script

查看:111
本文介绍了是否可以从其他脚本读取Google Apps脚本的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方式来阅读独立Google Apps脚本中script.gs文件的内容。我无法在Docslist.File服务中找到合适的getAs()MIME格式,但不会失败。这里的内容是我想使用html服务/内容服务来将公共GAS源样本嵌入到Google协作平台和其他地方。 (就像嵌入Gist Samples一样)。任何想法?

I'm looking for a way to read the contents of the script.gs files within a standalone Google Apps Script. I can't find a suitable getAs() Mime format in the Docslist.File service that doesn't fail. The context of this is that I want to use the html service/content service to be able to embed public GAS source samples in Google Sites and elsewhere. (in much the same way as embedding Gist Samples). Any ideas?

推荐答案

事实上,这是可能的。这获得Code.gs:

It is, in fact, possible. This gets Code.gs:

function myFunction() {
  throw ScriptApp.getResource("Code").getDataAsString();
}

这篇关于是否可以从其他脚本读取Google Apps脚本的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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