我在某个问题上卡住了。
我有一个HTML模板正在加载,该页面中有很多JavaScript代码。
我正试图通过使用Google Sheet的onOpen()
来缓存模板以加速操作。 我不知道如何缓存我的HTML页面CalForm.html
(从我的内部Google Sheet脚本中)。
这就是我现在拥有的:
创建缓存
function CacheCreate() {
CacheService.getScriptCache().put('CalCache', 'CalForm');
Browser.msgBox("done");
}
获取缓存
var evalSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Evaluation');
var row = evalSheet.getActiveCell().getRow();
var CalCache2 = CacheService.getScriptCache().get('CalCache');
Browser.msgBox(CacheService.getScriptCache().get('CalCache'))
initialize(row);
//var cache = CacheService.getScriptCache();
//var cache2 = cache.get('rss-feed-contents');
//Browser.msgBox(cache.get('rss-feed-contents'));
var html = HtmlService
.createTemplateFromFile(CalCache2)
.evaluate()
.setWidth(1200)
.setHeight(560)
.setSandboxMode(HtmlService.SandboxMode.NATIVE);
SpreadsheetApp.getUi().showModalDialog(html, 'Calculatrice');
感谢您的帮助!