R 使用json路径对googlesheets4进行非交互式身份验证
虽然它不是我的主要语言,但我使用R将每日ETL的结果发布到GoogleSheets工作表中。因为这将是一个永久运行的计划作业,所以我不太愿意使用交互流从R验证Google Drive。我有Google Drive帐户凭据中的JSON路径,但是当我通过R 使用json路径对googlesheets4进行非交互式身份验证,r,google-sheets,google-sheets-api,googlesheets4,R,Google Sheets,Google Sheets Api,Googlesheets4,虽然它不是我的主要语言,但我使用R将每日ETL的结果发布到GoogleSheets工作表中。因为这将是一个永久运行的计划作业,所以我不太愿意使用交互流从R验证Google Drive。我有Google Drive帐户凭据中的JSON路径,但是当我通过 gs4_deauth() gs4_has_token() gs4_auth(email=<email-string>, path = jsonlite::fromJSON(<path-to-json>), cache = N
gs4_deauth()
gs4_has_token()
gs4_auth(email=<email-string>, path = jsonlite::fromJSON(<path-to-json>), cache = NULL)
由于错误消息没有提供太多的细节,我想知道是否有人有这方面的经验或有任何想法,为什么会发生这种情况?我使用gs4_deauth()是因为我最初使用交互流登录,但现在希望确保非交互身份验证工作正常
顺便提一下,从json凭据文件创建令牌对象最简单的方法是什么?我认为这可能比使用path
参数直接重复传递json凭据更简单。对于服务帐户凭据:
googlesheets4::gs4_auth(
path=“service\u acout.json”,
作用域=”https://www.googleapis.com/auth/spreadsheets.readonly"
)
##注意:电子表格与服务帐户共享
s
[1] FALSE
Error: Can't get Google credentials.
Are you running googlesheets4 in a non-interactive session? Consider:
* `gs4_deauth()` to prevent the attempt to get credentials.
* Call `gs4_auth()` directly with all necessary specifics.
See gargle's "Non-interactive auth" vignette for more details:
https://gargle.r-lib.org/articles/non-interactive-auth.html
Execution halted