DEV Community

Discussion on: Google Sheets as your web backend

Collapse
 
maartyl profile image
maartyl

I've considered this too, but it has a major flaw: You can only safely use it as read-only database. So long as that is enough, you are fine, but updating the spreadsheet is a problem.

There are APIs to update it, sure, but they do not provide 'transactions' or other synchronization mechanisms. It doesn't even have an option to do "only perform the update if the current version of the table is ", so you can retry: i.e. kind of CAS.

If you only have one client at a time, that does not do any updates in parallel, it is kind of safe... but I would still not want to risk corrupting the data...

I have even looked at the scripting google sheets provide, and I think it might be callable through API (thus creating wrappers that do the synchronization, and you never update it any other way), but I have not looked into it enough. It seems like it's probably not worth it, over having a normal server.

Collapse
 
sarthakganguly profile image
Sarthak Ganguly

Actually, you can. Provided the sheet is shared to ONLY those you trust to not mess things up.

The mitigation is easy in any case. All you have to do is to restore a historical backup.

Please let me know if I could address your issue. :)

Collapse
 
maartyl profile image
maartyl

The point is lack of synchronization. No CAS, no transactions, no locks. - It's the same problems as any multi-threaded application mutating the same memory. You will get data races.

Trust is unrelated. It was my implicit assumption only trusted parties have edit access to begin with.