The link to the demo
SheetSQL builds a SQL engine into Google sheet by storing and retrieving data directly in Google Sheet.
##Usage There are two ways to run SQL statement:
- Click "SQL" in the menu and click "Show prompt"
- Type
=SQL(statement)
directly in a cell.
A long SQL statement example can be
SELECT DISTINCT a+1, b, MIN(c) FROM table1 JOIN table 2 WHERE (a = 1 AND b LIKE '%dads') OR c IN (SELECT c FROM table4) GROUP BY a,b HAVING AVG(c) > 5 AND MAX(c) < 10 ORDER BY a DESC LIMIT 20 UNION SELECT a+1, b, MIN(c) FROM table 3 GROUP BY a,b
I also have provided examples in the sheet for legible statement.
##Feature SheetSQL currently supports following SQL statements
- CREATE TABLE
- DROP TABLE
- ALTER TABLE
- INSERT INTO
- DELETE FROM
- UPDATE
- SELECT
In the Select, it support
- Math operation, like -,+,/.
- Aggregate Function, like MAX, MIN, COUNT, AVG, SUM
- DISTINCT *, DISTINCT column
- FROM
- JOIN, LEFT JOIN, RIGHT JOIN, ON
- UNION
- WHERE, AND, OR, IN, LIKE, IS NULL, IS NOT NULL
- GROUP BY
- HAVING
- ORDER BY
- LIMIT
I add an advanced feature fast select. The way to use it is to select a range in a table want to query. Run SQL query by using key word RANGE as the source for FROM. And the query will perform on the range you selected.
##Thanks
- simpleSqlParser to parse Insert, Update, Delete Statement
- sql-parser to parse Select statement
##Licence MIT