importing external javascript to google apps script [duplicate] importing external javascript to google apps script [duplicate] javascript javascript

importing external javascript to google apps script [duplicate]


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


you actually can . In the script project create another new file and simply just paste the JavaScript library copying from the source and save it then start referencing it from other file. It is that simple.

Or you can create another project with the .js lib and publish it and reference that script from the caller project, I wont do that unless that needs to be shared in multiple projects.


You cannot use external javascript libraries this way in Google Apps Script. (You can do so in html files used with the HtmlService. Since so much of Trello is client-side anyway, this may be just what you need.)

In server-side apps script, you should be able to access the library code using the technique from this answer. It doesn't say, but I'd imagine that you would put that eval outside of all functions in your script, to make the objects in the library available to the rest of your code.