Re:Google Spreadsheets and Python
by arthurdenture on Friday February 17, 2017 @12:00PM
(#13669752)
One thing to note is that the new version (v4) of the Sheets API can access the same fancy functionality that Apps Script can. So if gspread moves to that (which e.g. https://github.com/burnash/gspread/issues/435 alludes to), some of those limitations will go away.
(And the sync thing is neat!)
https://github.com/nithinmurali/pygsheets uses APIv4; someone couldn't wait!
I have also used Google Spreadsheets to act as a frontend of a database that people can dynamically update. I use the onEdit() function in google apps script and have found that it is not always reliable if edits are made in quick succession. I would definitely be interested on how you created your bidirectional synced system.
Sign me up for your product or service, would definitely be interested in seeing code for this.
I would love to take a look at the source code for this!
Re:Google Spreadsheets and Python
by gregorymichael on Friday February 17, 2017 @11:44AM
(#13669579)
(author here) Would love to see the code for this!
(gspread's author here) Thank you for the comprehensive tutorial!
Re:Google Spreadsheets and Python
by brian_herman on Friday February 17, 2017 @11:42AM
(#13669566)
Yes, please post to github, gitlab, or bitbucket!
As another note, we realized that far more useful than using Google Spreadsheets as the canonical backing database, was to be able to bidirectionally synchronize it with our primary database. That way, users who wanted to annotate entities in spreadsheet form could do so in GSheets, always working with up-to-date data, and keeping track of "I updated a.x in the spreadsheet, but a.y was updated upstream, so merge the two." Here were the semantics of our integration:
The caller would then be responsible for taking the returned list of updates and cleaning it for the database, as well as maintaining a record of what the state of the last sync was. Essentially we maintain enough information to do a three-way merge. We've since built internal applications that allow real-time spreadsheet-like interactions in a much more domain-specific manner, but it definitely did the job for quite a while.If there's interest in seeing open-source code for all of this, we could definitely extract from our corporate repo (we're https://www.belstone.com/ ). Let me know!