tidyverse / googlesheets4

Google Spreadsheets R API (reboot of the googlesheets package)
https://googlesheets4.tidyverse.org
Other
357 stars 51 forks source link

Use auth token with httr read rds file #307

Open HugoGit39 opened 9 months ago

HugoGit39 commented 9 months ago

Hi

So let me begin that its not a real bug, but more a question for help:

From the rangespread()function I see that a google sheet can be read using the auth token via:

`# service account token drive_auth(path = "....json")

google4sheets authentication

gs4_auth(token = drive_token())

token <- gs4_token() response <- httr::GET(url, config = token) df <- read_csv(content(response, type = "raw"))`

So for an RDS file I thought it should be the same. However the response I get is a

Content-Type: text/html; charset=utf-8

Does anyone know how i can extract the df correctly?

Cause without an auth token the response of a RDS file can be read via:

response <- httr::GET(url)
cn <- rawConnection(httr::content(response, type = "raw"))
df <- readRDS(gzcon(cn))