Berry Tsakala
Berry Tsakala

Reputation: 16600

get a google document by its title?

I want to read text from a google document using google drive API (and python).

With "gdata" module, I didn't find a way to get a document object by its title. A module named gspread does just that.

(I don't know any other module besides gdata. "gspread" is a module that solves exactly this kind of questinos and simplifies the interaction with googleapi, but it's for spreadsheets, not for documents).

So far I know how to iterate over a list of all items in the "drive" (with GetDocumentListFeed) and get the relevant doc by comparing each item'ts title.text.

is there a way to do something like

item = client.get(title='lalala') 

?

Upvotes: 0

Views: 89

Answers (1)

Alex
Alex

Reputation: 135

It is possible but using the new Google Drive API. Using the list call and then a specific search query (See link below). If you are using the client library the call is as simple as:

file = client.files().list(q="title='YOUR TITLE'").execute()

This will return the items in your drive that match that title (in a dictionary). There are a lot more search queries that are possible if you visit this page

Upvotes: 1

Related Questions