importing external javascript to google apps script

后端 未结 5 604
一向
一向 2020-12-01 02:31

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 o

相关标签:
5条回答
  • 2020-12-01 02:49

    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.

    0 讨论(0)
  • 2020-12-01 02:55

    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());
    
    0 讨论(0)
  • 2020-12-01 02:57

    Download them and put them in the script. The rest api is easy to use. Ive used trello rest from appscript.

    0 讨论(0)
  • 2020-12-01 02:57

    Yes you can use JavasSript libraries in Google script. Copy all content of the libraries JavaScript and post it in new GS file.

    0 讨论(0)
  • 2020-12-01 03:01

    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.

    0 讨论(0)
提交回复
热议问题