将外部 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());