Reputation: 1
I'm trying to set a spreadsheet by their title, but when I use gs_ls I only obtain the last 500 sheets updated.
I had tried to obtain an spreadsheet object using gs_title, but I obtained an error message with the message "doesn't match sheet_title of any sheet returned by gs_ls()" that's why I want to obtain more than the last 500 sheets updated. My spreadsheet was updated previously than these 500 sheets.
> title=gs_title('XXXX')
Auto-refreshing stale OAuth token.
Error in gs_lookup(., "sheet_title", verbose) :
"XXXX" doesn't match sheet_title of any sheet returned by gs_ls() (which
should reflect user's Google Sheets home screen).
I had the same problem using with gs_url and with gs_key. I obtained the same message: "XXXX doesn't match sheet_key of any sheet returned by gs_ls()".
Is there any option to obtain more elements with gs_ls or to obtain the googlesheets object for a sheet not listed in gs_ls?
Upvotes: 0
Views: 134
Reputation: 1
I found the solution, if you use gs_key or gs_url without specify conditions, you can't obtain the spreadsheets object if the sheet is not in gs_ls list. But using the lookup and visibility options, I could identify the sheet and obtain the spradsheets object. For that you can use gs_key or gs_url:
key = gs_key('xxxxx', lookup = F, visibility = 'private')
url = gs_url('xxxxx', lookup = F, visibility = 'private')
Upvotes: 0
Reputation: 834
As per the ?gs_ls()
documentation:
Which sheets show up in this table? Certainly those owned by the user. But also a subset of the sheets owned by others but visible to the user. We have yet to find explicit Google documentation on this matter. Anecdotally, sheets owned by a third party but for which the user has read access seem to appear in this listing if the user has visited them in the browser. This is an important point for usability because a sheet can be summoned by title instead of key only if it appears in this listing. For shared sheets that may not appear in this listing, a more robust workflow is to specify the sheet via its browser URL or unique sheet key.
Upvotes: 1