Hello
I can open a Googlesheet and get all sheet names inside with functionsheet_names()
with a GoogleSheetsClient
and its id
.
However, I never found how to get the Spreadsheet name which is displayed in the browser.
I see a function gsheet_api_spreadsheet_get()
but I do not understand what argument I should use. I have looked at the doc of the package for the answer but somehow missed it.
Thanks for your help.
So I know nothing about this library but had a look at the docs and found the meta
function which seems to get a lot of metadata. If I understand correctly you want the name of the spreadsheet itself and I would expect this to be contained in this metadata. You don’t need to know the key I think and can just call this function with the spreadsheet to get all key-value pairs (but the docs are not explicit about this so this is my interpretation).
1 Like
Indeed. The following code will get it done:
using GoogleSheets
googleclient = sheets_client(AUTH_SCOPE_READWRITE)
mysheetid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # have a valid id here
mysheet = Spreadsheet(mysheetid)
mydict = meta(googleclient, mysheet) # a dictionary is returned
mypropertiesdict = = get(dico, "properties", 0) # another dict inside the first dict
mytitle = get(mypropertiesdict, "title", "")
I was looking for something called “properties” not “meta”. Of course meta makes sense as well.