'How to get all the text from a google doc using the ruby api?

I am trying to use the Google Ruby API to get all the text from a google doc. Currently on their website it has examples on how to do this using Java and Python, but not ruby.

I am able to get all content from the body using the following code:

document = service.get_document document_id
data = document.body.content

This returns a really ugly Google structural element.

Anyone achieved this before, if so how? Any help would be great.



Solution 1:[1]

You can extract the text of the google doc using the v3 API.

Use the following URL to under the API https://developers.google.com/docs/api/samples/extract-text#python

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Umyhacker