Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call jQuery From Google SpreadSheet Script

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.)

like image 610
chernevik Avatar asked Mar 07 '12 18:03

chernevik


People also ask

Can you use jQuery in Google script?

Anatomy of a Handler. Google Apps Script allows us to use jQuery, which is the preferred technique in HTML programing to date. I highly recommend learning as much jQuery as possible.

Does Google Docs use Ajax?

Some good examples of Ajax applications are Google Maps (http://maps.google.com/), Gmail (http://gmail.google.com/), and Google Docs and Spreadsheets (http://docs.google.com).


1 Answers

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
like image 183
Mogsdad Avatar answered Oct 09 '22 04:10

Mogsdad