How to load javascript from external source and ex

2019-03-22 08:03发布

I am building some google apps scripts and want to load a javascript file located on one of my servers and be able to execute it's functions in Google Apps Script.

This way I can share a google apps script with people and update the javascript without effort needed from their side. (I would just update the version on my server which is then loaded in their Google Apps Script.

Is there a way to do this?

1条回答
我命由我不由天
2楼-- · 2019-03-22 08:57

You can do this:

eval(UrlFetchApp.fetch("my url").getContentText())

Although it would be a lot faster/more efficient to cache the code in ScriptDb or CacheService and only fetch it fresh every 15 minutes or so.

查看更多
登录 后发表回答