How to download all your Google documents from the shell

I learned how to download one google doc. But I'm trying to make a script that loads all my data in text format, and then combines them into 1 text file. Therefore, I am wondering how to implement the download so that 1 can get a zip file with all my files in the same way as with a web browser. Here is my newb script for getting a single file. Hope you can suggest some tweaks that will make it more efficient.

#!/bin/bash token=$(curl -s https://www.google.com/accounts/ClientLogin -d Email=user.name@gmail.com -d Passwd=blahblah -d accountType=GOOGLE -d service=writely -d Gdata-version=3.0 |cut -d "=" -f 2) set $token wget --header "Gdata-Version: 3.0" --header "Authorization: GoogleLogin auth=$3" "https://docs.google.com/feeds/download/documents/Export?docID=${resourceId}&exportFormat=txt" -O /tmp/${file[$i]}.txt 

Here I specify one resourceId , as you see. Should I just click a lot of resourceId -s in the download link to get them all or is there a better way?

+4
source share
2 answers

If you don't mind using a non-local tool, I would highly recommend: http://code.google.com/p/googlecl/

However, given the age of this question, you may already have understood this.

+2
source

You can also use the archive feed for the document API to export your documents as a zip file:

https://developers.google.com/google-apps/documents-list/#managing_archives_of_documents_and_files

0
source

Source: https://habr.com/ru/post/1308479/


All Articles