简体   繁体   中英

How to load javascript from external source and execute it in Google Apps Script

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM