SQL for Apps Script – it’s here

179 views
Skip to first unread message

Bruce Mcpherson

unread,
Jul 21, 2021, 10:26:14 AM7/21/21
to Google Apps Script Community
While working on Sheets Workbook functions – converted to Apps Script I realized that I’d need to tackle the query language at some point, so I figured I may as well go the whole hog and implement a comprehensive SQL variant for Apps Script. Luckily though, I found alasql so with a few tweaks it was ready to go – it’s available through my library bmAlasql


I also wanted to make it compatible with my fiddler library, as many of you already use it for fiddling with Sheets data. Here’s how it all works and fits together. There’s still a bit of work to do but it’s good enough to get started with.

Alex

unread,
Jul 21, 2021, 1:32:09 PM7/21/21
to Google Apps Script Community

Bruce Mcpherson

unread,
Jul 21, 2021, 5:29:24 PM7/21/21
to google-apps-sc...@googlegroups.com
I’ve come  across a few little bugs so far, but it’s pretty good in any case.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/0563ffe6-e96d-43a5-b0c5-7498d6b1d736n%40googlegroups.com.

Alex

unread,
Jul 21, 2021, 11:54:59 PM7/21/21
to Google Apps Script Community
For several years of use, I have only positive feedback. This DBMS processes an impressive amount of data in 6 minutes!

Clark Lind

unread,
Jul 28, 2021, 12:35:49 PM7/28/21
to Google Apps Script Community
Hi Bruce,
Before I try to wrap my head around this, what kind of use-cases do you see that can benefit from this? 

Cheers,,
Clark

Bruce Mcpherson

unread,
Jul 29, 2021, 4:32:01 AM7/29/21
to google-apps-sc...@googlegroups.com
Hi Clark

I originally did this to enable another thing I'm working on - the conversion of Workbook functions to Apps Script - which is probably more for the challenge than for utility of the result.

However, in addition to being able to easily write complex queries in Apps Script using SQL (think about collecting natural language queries in a UI and then having to convert that to apps script for example), or for playing around with data pre- database conversion. It's also  very useful for easily joining sheets on key fields, and summarizing data. All stuff that can be code intensive in apps script.

cheers
bruce


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Clark Lind

unread,
Jul 29, 2021, 8:54:24 AM7/29/21
to Google Apps Script Community
Awesome, thank you! 

Alex

unread,
Jul 29, 2021, 9:29:49 AM7/29/21
to Google Apps Script Community
My the best practice is grouping data. It's not a trivial task create an universal function for grouping and pivoting. Adding a new field to the function is a big deal.
Reply all
Reply to author
Forward
0 new messages