-1

I need to parse the data contained in a table on a Google Doc that looks like so:

enter image description here

This code:

import requests

def retrieve_parse_and_print_doc(docURL):
    response = requests.get(docURL)
    assert response.status_code == 200, 'Wrong status code'
    lines = response.content.splitlines()
    for line in lines:
        print(line)

retrieve_parse_and_print_doc('https://docs.google.com/document/...[elided]/pub')

...returned data, but it doesn't appear to be useful:

enter image description here

So how can I extract the table's data?

1
  • 1
    From your URL, I guessed that your Google Document has been published as the Web publish. If my understanding is correct, I guessed that you might want to achieve without the authorization process. Is my guess correct? And, in your situation, has your Google Document also been publicly shared? Or, if it has never been publicly shared, can you do it? I thought that the approach would depend on the situation.
    – Tanaike
    Commented Aug 5 at 0:34

1 Answer 1

1

You should set up Google API then use Google Doc API for that.

According to the REST Resource: documents you can return a table object :

"table": {object (Table)}

table object (Table) : A table type of structural element.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.