0

For the past 6+ months I read and wrote from R to Google Sheets without any issues, with the googlesheets4 package. Yesterday, all of a sudden, I started to get the 'Can't get Google credentials' error and I can't seem to find a solution to it.

I've always used gs4_auth('email address'), no other details.

I read the troubleshooting advice for gargle, I also found another thread here with suggestions, but nothing worked for me unfortunately. Here is what I get when changing gargle verbosity to 'debug':

trying token_fetch() trying credentials_service_account() Error caught by token_fetch(): Argument 'txt' must be a JSON string, URL or file. trying credentials_external_account() aws.ec2metadata not installed; can't detect whether running on EC2 instance trying credentials_app_default() trying credentials_gce() trying credentials_byo_oauth() Error caught by token_fetch(): inherits(token, "Token2.0") is not TRUE trying credentials_user_oauth2() Gargle2.0 initialize attempt to access internal gargle data from: googlesheets4 adding "userinfo.email" scope Error caught by token_fetch(): ReadItem: unknown type 50, perhaps written by later version of R

I don't have a clue what to change based on this info.

I also read that this sudden error may happen if the cache where gargle saves authentication data is full. But I don't find the cache. I tried to run this:

require(gargle) gargle_oauth_sitrep()

And I get: Error in FUN(X[[i]], ...) : ReadItem: unknown type 50, perhaps written by later version of R.

My version of R is 4.1.2 now, but before, it was 4.1.0. I updated it hoping it would solve something, but it didn't. I also reinstalled a few packages: curl, openssl, gargle. Still not working.

I am out of ideas now. Can anyone help?

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Anca
  • 9
  • 2

1 Answers1

1

I found my gargle cache flies by executing
rappdirs::user_cache_dir("gargle") and in the R console it gave me this answer:

Library/Caches/gargle

I deleted all files in that directory and voila the next time I used read_sheet() I had to login to my gmail account, click a box to allow googlesheets4 to read and write my google sheets and now it works.

benson23
  • 16,369
  • 9
  • 19
  • 38
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 02 '22 at 22:21