How to convert document from Google Docs to text file
No need to pipe to other program to convert the file. You can download from Google Docs in any supported format, by using the existing parameters in the URL address.
https://docs.google.com/document/d/FILE_ID/export?format=FORMAT
where:
-
FILE_ID
is string ID of target file and; -
FORMAT
is file format of choice i.e.txt
Then, downloading the document from Google Docs as text file is straightforward by using wget
or a web browser. Both methods will download the document as text file as expected.
I have tried myself and the output looks something like this:
$ wget https://docs.google.com/document/d/FILE_ID/export?format=txt
--####-##-## ##:##:##-- https://docs.google.com/document/d/FILE_ID/export?format=txt
Resolving docs.google.com (docs.google.com)...
Connecting to docs.google.com (docs.google.com)... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘export?format=txt’
[ <=> ] 649 --.-K/s in 0s
####-##-## ##:##:## (##.# MB/s) - ‘export?format=txt’ saved [649]
The URL address for other products such as Google Sheets, Google Presentation or even Google Drive would be slightly different.
In terms of documentation, the only relevant guide I found was this dated blog post circa 2014. There is this page of developer guide for Google Drive but not useful as it is. That is all.