将外部JavaScript导入Google应用程序脚本 [英] importing external javascript to google apps script
问题描述
我尝试从Google Spreadsheet(Google文档)中使用Trello,但不知道如何导入/引用/链接使用其库所需的JavaScript文件。我唯一的选择是直接使用他们的REST API(很好,但我宁愿使用他们的js helper类)。
这就是Trello需要我们使用的:
/ p> < script src =http://code.jquery.com/jquery-1.7.1.min.js> ;< /脚本>
< script src =https://api.trello.com/1/client.js?key=substitutewithyourapplicationkey< / script>
如何将这些内容导入Google Apps脚本中?
谢谢!!!
基于Cameron罗伯茨,则可以使用eval()函数的appscript UrlFetchApp功能。
的eval(UrlFetchApp.fetch( 'http://path.to/external/javascript.js')。 getContentText());
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).
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>
How would I import/include these in a Google Apps Script?
THANKS!!!
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导入Google应用程序脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!