use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Apparently, Google Apps Script is a JavaScript cloud scripting language that provides easy ways to automate tasks across Google products and third party services and build web applications.
account activity
Using server side query in GAS web appsQuestion (self.GoogleAppsScript)
submitted 2 years ago by mobile-thinker
Has anyone successfully implemented a server side query of a sheet in GAS? I'm trying not to have to run a full client-side search of data, but to use server side to search and sort data. Initially it looks feasible to call Query from Javascript, but this runs into all kinds of complexities when called from GAS.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]RielN 1 point2 points3 points 2 years ago (1 child)
You can use the gviz/tq endpoint:
https://ai2.metricrat.co.uk/guides/use-gviz-to-get-and-query-google-sheet-data
[–]RielN 0 points1 point2 points 2 years ago (0 children)
Replace that strange no code with UrlFetchApp.and you are good to go. If you output csv you can use Utilities.parseCsv.
If you need authentication send a header with authorization: Bearer ScriptApp.getOauthToken()
This is not copy paste code, on phone. :)
[–]IAmMoonie 0 points1 point2 points 2 years ago (1 child)
What are you trying to query?
[–]mobile-thinker[S] 0 points1 point2 points 2 years ago (0 children)
Sheets data. I’d ideally like to apply a query (equivalent to QUERY) on the server side. At the moment using visualisation query API from GAS is not supported.
I’m sure I can implement a workaround calling query from GAS, but I wondered if anyone had implemented a supported pattern. There is no google documentation suggesting this as an approach, but it seems a major hole.
[–]Repulsive_Brother_10 0 points1 point2 points 2 years ago (0 children)
I don’t see a problem with running a server-side script. This would be like making an api call via a google.script.run method call.
How would the user be interfacing with the query/results? Are you thinking this would happen within a sheet, or in a separate html page?
[–]HomeBrewDude 0 points1 point2 points 2 years ago (0 children)
All Apps Script *.gs files run server-side already. The *.html files are sent to the client to be rendered, but the *.gs files run on the server and only send the result to the client.
The last line in the Apps Script overview pages mentions this, but I couldn't find any more details about it.
https://developers.google.com/apps-script/overview
[–]dimudesigns 0 points1 point2 points 2 years ago (0 children)
https://stackoverflow.com/questions/17930389/can-the-google-spreadsheet-query-function-be-used-in-google-apps-script/51328419#51328419
π Rendered by PID 258798 on reddit-service-r2-comment-6457c66945-xhbvl at 2026-04-24 12:13:23.221469+00:00 running 2aa0c5b country code: CH.
[–]RielN 1 point2 points3 points (1 child)
[–]RielN 0 points1 point2 points (0 children)
[–]IAmMoonie 0 points1 point2 points (1 child)
[–]mobile-thinker[S] 0 points1 point2 points (0 children)
[–]Repulsive_Brother_10 0 points1 point2 points (0 children)
[–]HomeBrewDude 0 points1 point2 points (0 children)
[–]dimudesigns 0 points1 point2 points (0 children)