Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Download, back up, and upload Google Docs files Internet
You can download, back up, and upload documents from your Google Docs account using a little Terminal magic. Prerequisites:
  1. gdata-python-client 2.0.1 - download page
  2. gdatacopier 1.0.2 - download page
Installation:
  1. Download the prerequisites. Decompress each of the downloads.
  2. Install gdata-python-client:
    $ cd gdata-2.0.1<br>
    $ sudo python setup.py install
Patch:

The current gdatacopier download has a small bug in it, and it needs to be patched to work properly. Open the file gdatacopier.py in the app's folder, and locate line 555. On that line, change this...
item_list.append({'title': entry.title.text.encode('UTF-8'),
...to this...
item_list.append({'title': entry.title.text,
Save the file and quit the editor.

Usage:

By default, gdatacopier will download your spreadsheets and text documents in the OpenOffice format (.ods and .odt, respectively). TextEdit does a pretty good job of opening the text (.odt) documents, but I was unable to find anything free that could open the spreadsheet (.ods) documents, so you may want to specify a specific format when downloading your documents.

Variables
  • $DIR = local download location
  • $USERNAME = Google email (e.g. someone@gmail.com)
  • $GOOGLEID = Google docs id number. You can find the document's Google ID by using the list- commands below. Make sure to copy only the Google ID from the listing -- not the date or other data. Also make sure to enclose the Google ID in quotes in your command.
Examples:
  • Display gdatacopier help: ./gdoc-cp.py --help
  • Back up all Google Docs in OpenOffice format: ./gdoc-cp.py --username someone@gmail.com --export default --google-id all --local $DIR
  • Back up all Google Docs spreadsheets in Excel format: ./gdoc-cp.py --username $USERNAME --export xls --google-id spreadsheets --local $DIR
  • Back up all Google Docs Text in Rich Text format (retains most formatting): ./gdoc-cp.py --username $USERNAME --export rtf --google-id documents --local $DIR
  • Back up all Google Docs in PDF Format: ./gdoc-cp.py --username $USERNAME --export pdf --google-id all --local $DIR
  • List all Google Docs: ./gdoc-cp.py --username $USERNAME --list-all
  • List all Google Docs spreadsheets: ./gdoc-cp.py --username $USERNAME --list-sheets
  • List all Google Docs text documents: ./gdoc-cp.py --username $USERNAME --list-docs
  • Find a specific Google Doc by title: ./gdoc-cp.py --username $USERNAME -p $PASSWORD --list-all | grep Casserole
  • Download a specific text document in TextEdit (rtf) format: ./gdoc-cp.py --username $USERNAME --export rtf --google-id "$GOOGLEID" --local "OUTPUT_FILENAME.rtf"
  • Download a specific spreadsheet document in Excel (xls) format: ./gdoc-cp.py --username $USERNAME --export xls --google-id "$GOOGLEID" --local "OUTPUT_FILENAME.xls"
  • Download a specific document in PDF format: ./gdoc-cp.py --username $USERNAME --export pdf --google-id "$GOOGLEID" --local "OUTPUT_FILENAME.pdf"
  • Upload a document to Google Docs (rtf, txt, xls, doc): ./gdoc-cp.py --username $USERNAME --import --local "INPUT_FILENAME" --title "OPTIONAL_TITLE"
Notes:
  • A password can be hardcoded into the command if desired.
  • The current version of gdatacopier (1.0.2) is unable to upload all the file types supported by Google Docs (including PDF, html, docx, and possibly others -- that's all I tested).
  • gdatacopier-1.0.3 in the repository appears to offer support for presentations and some other options including folders (aka tags). If you want to play around with it you can get it here. (The code must be patched as above, plus also patch line 289: download_document(document_id, file_format, local_path, write_metadata) -- change that to download_item(document_id, file_format, local_path, write_metadata).)
  • A future v2.0 is in the works, hopefully soon.
  • Maybe a crafty AppleScript Studio programmer could write a GUI for all this.
[robg adds: I haven't tested this one.]
    •    
  • Currently 1.50 / 5
  You rated: 1 / 5 (14 votes cast)
 
[16,423 views]  

Download, back up, and upload Google Docs files | 2 comments | Create New Account
Click here to return to the 'Download, back up, and upload Google Docs files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Download, back up, and upload Google Docs files
Authored by: chunkbot on Aug 26, '09 01:23:09PM

This looks pretty cool. The company I work for is looking at getting a Google Enterprise group account set up so that the people who were using google docs on their personal accounts for work, can have those docs managed in a central location... this looks like the easiest (mostly) pain-free way to migrate them that I've seen.

Too bad I'll have to basically do the whole thing by hand though. :\ time to learn to automate.



[ Reply to This | # ]
Download, back up, and upload Google Docs files
Authored by: bluehz on Aug 27, '09 07:23:04AM

Check the docs on the google code webpage - I am not sure - but I seem to remember reading somewhere that this currently only works for Google Personal and not Google Enterprise/Domain.



[ Reply to This | # ]