rr-googlesheets

Is there any option to obtain more than 500 results with gs_ls()?


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?


Solution

  • 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')