Due to security settings, it's difficult for us to publicly share documents from Google Drive. This script makes it trivial to publish a doc to the open web.
First thing you'll need to do is set up your repository as follows:
git clone https://github.com/18f/gapps-download
cd gapps-download
npm install
Then, follow step 1 of instructions here: https://developers.google.com/apps-script/guides/rest/quickstart/js.
Download the client_secret.json from Google Drive.
Now, you're ready for action.
Once you identify your document's ID (hint, it's in the URL), downloading is as simple as:
node index DOC_ID DOC_TYPE
For a list of the document types, visit https://developers.google.com/drive/web/manage-downloads#downloading_google_documents.
(Note: Because this script streams to process.stdout
it is possible to pipe to other applications, such as uploading to S3).
node index 12345 text/html > out.html # Download a google doc to `out.html`
node index 12345 text/csv > out.csv # Download a google sheet to `out.csv`
node index 12345 > out.pdf # Download a google doc as a pdf
node index 12345 application/vnd.openxmlformats-officedocument.wordprocessingml.document > out.docx # Download google doc as a MS Word Document
See LICENSE.md.