I have a spreadsheet in google docs that I'd want to integrate in a git workflow (and push to github). Are there any tools (or even libraries that are gdoc version aware) that do, or help me do, that?
I have some old ruby hacks lying around based on the google_spreadsheet gem that reads and writes current versions of a csv gdoc, but nothing which extracts revision history.
I was intrigued by your question, so I hacked together a little project today:
Given a document id, it will create a git repository using either the plain text or HTML content of a Google Docs document. This could easily be extended to work with other file types. It looks something like this when it works:
$ python gitdriver.py -T 1j6Ygv0ow5A8_ywTMwJbuKVrxrSsSH2wJs3a8Q66mvt4 Create repository "Untitled" Initialized empty Git repository in /home/lars/projects/gitdriver/Untitled/.git/ [master (root-commit) 24d35e7] revision from 2013-01-08T21:57:38.837Z 1 file changed, 1 insertion(+) create mode 100644 content [master fd243ee] revision from 2013-01-08T21:57:45.800Z 1 file changed, 1 insertion(+), 1 deletion(-) rewrite content (95%) [master 5ad1a26] revision from 2013-01-09T01:47:29.593Z 1 file changed, 1 insertion(+), 1 deletion(-) rewrite content (92%) $ cd Untitled $ git log --oneline 5ad1a26 revision from 2013-01-09T01:47:29.593Z fd243ee revision from 2013-01-08T21:57:45.800Z 24d35e7 revision from 2013-01-08T21:57:38.837Z
This requires you to set up the necessary application credentials with Google. And it doesn't do any error checking. And may eat your goldfish. This is meant as a demonstration of the API and how you might do something like this; it's not intended to be a functional product.
gdoc is not set up for exporting revision history source.
Google drive does have an API to access all the revisions here. That provides an easy way to download all the revisions. Then you can create a script to add them one by one to git. There are some problems with the revision history see here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With