importing external javascript to google apps script

dixkin picture dixkin · Sep 5, 2013 · Viewed 18.8k times · Source

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!!!

Answer

owyongsk picture owyongsk · Oct 24, 2015

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());