将外部 javascript 导入谷歌应用程序脚本 [英] importing external javascript to google apps script

查看:27
本文介绍了将外部 javascript 导入谷歌应用程序脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Google 电子表格(Google 文档)中使用 Trello,但不确定如何导入/引用/链接使用其库所需的 javascript 文件.我唯一的其他选择是直接使用他们的 REST API(很好,但我宁愿使用他们的 js 帮助程序类).

I am trying to use Trello from a Google Spreadsheet (Google Docs) and am not sure how to import/reference/link the javascript files required to use their library. My only other option is using their REST API directly (fine, but I'd rather use their js helper classes).

这是 Trello 需要我们使用的:

This is what Trello needs us to use:

 <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
 <script src="https://api.trello.com/1/client.js?key=substitutewithyourapplicationkey"</script>

我如何将这些导入/包含在 Google Apps 脚本中?

How would I import/include these in a Google Apps Script?

谢谢!!!

推荐答案

基于这里的答案 Cameron Roberts,您可以在 appscript UrlFetchApp 函数上使用 eval() 函数.

Based on the answer here by Cameron Roberts, you can use the eval() function on the appscript UrlFetchApp function.

eval(UrlFetchApp.fetch('http://path.to/external/javascript.js').getContentText());

这篇关于将外部 javascript 导入谷歌应用程序脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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