DEV Community

Cover image for How to Use Google Sheets as a Database (Responsibly)

How to Use Google Sheets as a Database (Responsibly)

Jacob Lee on October 07, 2020

While database technology and other tools have come a long way, it's still tough to beat the humble spreadsheet's versatility and intuitiveness. Wh...
Collapse
 
run_lok_49e9125e357be2846 profile image
run lok

Great blog post! Especially I liked the section about "Endpoints". Recently, I've researched this topic and found another blog post explaining how to use Google Sheets as a database blog.coupler.io/how-to-use-google-..., set it up with the API, as well as covers use cases for a website, HTML page, Django app, inventory, and others.

Collapse
 
serchavalos profile image
Sergio Avalos

Thanks for the article @jacob !

I'm not familiar with Google's API and I don't know how much can be tailored from the permissions users can grant to access Google Sheets. If possible, I suggest updating this demo app to be more restrictive and grant for fewer permissions.

Cheers!

Collapse
 
hacubu profile image
Jacob Lee

Hey @serchavalos , thanks for the feedback! Because we support the full Google Sheets API the permission grant needs to be a bit broad. Could definitely see something more granular being valuable/giving peace of mind in the future though.

Collapse
 
tripol profile image
Ekanem

" While using them for sensitive, critical applications like storing COVID-19 patient data is ill-advised"

lol I see what you did there. Really informative article. Thanks a lot

Collapse
 
thatjimmy profile image
James

I tried it out, it seems really neat. Anyway to authenticate the endpoint you create?

Collapse
 
kevinchandra profile image
Kevin Chandra

Hey James, we at cotter.app did a collab with Autocode on this. Check it out at autocode.com/app/putri/gsheets-dat.... Hope this helps! If you have more questions about authentication, please feel to ask my CTO directly at putri@cotter.app or join our Slack channel here join.slack.com/t/askcotter/shared_....

Collapse
 
hacubu profile image
Jacob Lee

Hey James, within Autocode, you can restrict access to your API to specific IPs or require specific users' library tokens to be passed in with the API call using the "Share" button in the top left. However, if you're planning to use this directly from the frontend, you wouldn't want to expose your library tokens like that and would have to roll your own login system.

Collapse
 
thatjimmy profile image
James

That's great. I've been using sheets to export json, that is then used as a data source for a static site generator. If I can lock it down to internal use only, this could save some steps. Thanks!

Collapse
 
wpbryant profile image
William

Incorrect, Bill Nye is not a scientist. He is an actor.

Collapse
 
hacubu profile image
Jacob Lee • Edited

Pop scientist then? Scientist educator? I'm really not trying to retake all these screenshots 😂

Collapse
 
wpbryant profile image
William

😂

Collapse
 
xbootnek profile image
xbootnek

Bill Nye the Science Guy, is an American science communicator, television presenter, and mechanical engineer. Bill Nighy is an English actor known for his work in film, theatre and television.

Collapse
 
wpbryant profile image
William

"television presenter"
Actor.

Collapse
 
iaremarkus profile image
Markus

Don't ruin my childhood William :D

Collapse
 
wouterv profile image
WouterV

Cool! I'm not a fan of straight js, does autocode also support typescript?

Collapse
 
hacubu profile image
Jacob Lee

Currently no, there's type-checking at the interface level around parameters though: github.com/FunctionScript/Function...

Collapse
 
easrng profile image
easrng

Google Sheets has a built in SQL query API. Google google sheets gviz tq to probably find more info.

Collapse
 
xuantruong1999 profile image
Xuan Truong

Cool!

Collapse
 
manishfoodtechs profile image
manish srivastava
Collapse
 
ldoreno profile image
Leonardo

I have just signed up and created a function to write a rather static message to url.dev.

Am here to say that it is awesome!

Collapse
 
bikerr83 profile image
BikerR83

And if you use the google disk itself as a database? The file folder is a table row?!