从Google SpreadSheet脚本中调用jQuery
问题描述:
如何在连接到Google Spreadsheet的脚本中使用jQuery? Google Libraries页似乎很简单,但显然我误解了库的执行环境,在脚本中调用google.load()失败。从Google SpreadSheet脚本中调用jQuery
那么这样做的正确方法是什么?我可以想象像UrlFetchApp.fetch()调用的想法,但这看起来并不正确。
(我知道我感到困惑的各种谷歌应用程序的环境中,所以要清楚:我说的是保存在工具下的“脚本编辑器”的谷歌文档电子表格菜单上的脚本)
答
可以使用Google Apps脚本中的jQuery,但只能通过HtmlService,并且只能在客户端脚本中使用。它在HtmlService Best Practices文档中提到。
一些例子,你会发现这里在计算器上:
- Browser Pop up in Google Apps Script
- How to make a tab panel using HTML Service
- jQuery onblur with Google Apps Script
- Populate jQuery autocomplete list using value array from Google Spreadsheet
- Use HtmlService, CSS & jQuery to overlay images in Google Apps Script WebApp
- How do I run Server-side functions using HtmlService
- Using DataTables plug-in in jQuery
我不确定,但我不认为您可以在Google Apps脚本中使用外部脚本。 – 2012-03-07 18:57:09
您当然可以,我已经看到了模式>用于引入第三方脚本。 – chernevik 2012-03-07 19:10:46
让我换个方式 - 我认为你不应该* * - 你的模式清楚地表明了这一点。 :-P – 2012-03-07 19:15:32