从Google SpreadSheet脚本调用jQuery [英] Call jQuery From Google SpreadSheet Script

查看:66
本文介绍了从Google SpreadSheet脚本调用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在连接到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:

这篇关于从Google SpreadSheet脚本调用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆