从Google SpreadSheet脚本调用jQuery [英] Call jQuery From Google SpreadSheet Script
问题描述
如何在连接到Google Spreadsheet的脚本中使用jQuery? Google图书馆页面似乎很简单,但显然我误解了执行环境图书馆,在脚本中调用google.load()失败。
那么正确的方法是什么?我可以想象像UrlFetchApp.fetch()调用的想法,但这看起来不是正确的方式。
(我知道我对各种Google App环境感到困惑,所以要清楚:我正在讨论保存在脚本编辑器中的脚本,位于Google文档电子表格的菜单中的工具下。)
可以使用Google Apps脚本中的jQuery,但只能通过HtmlService,并且只能在客户端脚本中使用。它在 HtmlService最佳实践文档。
您可以在StackOverflow上找到一些示例:
How do I use jQuery in a script attached to a Google Spreadsheet? The Google Libraries page seems to make it simple but apparently I misunderstand the execution environment for Libraries, calling google.load() in the script fails.
So what is the right way to do this? I can imagine ideas like calls on UrlFetchApp.fetch() but that doesn't seem like the right way.
(I know I get confused with the various Google App environments, so to be clear: I'm talking about a script saved in the 'script editor' under Tools on the menu for a Google Docs Spreadsheet.)
It is possible to use jQuery from Google Apps Script, but only through the HtmlService, and only in client-side scripts. It's mentioned in the HtmlService Best Practices documentation.
Some examples you'll find here on StackOverflow:
- 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 SpreadSheet脚本调用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!