2015-09-30 40 views
1

我遇到一些问题。我在一台机器上成功使用了R-Script。在不同的计算机上使用的相同的脚本会导致问题:如何使用库(Google表格)更改Google帐户?

# Here I register the sheet 

browser <- gs_title("Funnel Daily")

browser<-gs_edit_cells(ws="Classic Browser", browser, input = ClassicBrowser, anchor = "A1",byrow = FALSE, col_names = NULL, trim = F,verbose = TRUE)

Auto-refreshing stale OAuth token. 
Error in gs_lookup(., "sheet_title", verbose) : 
"Funnel Daily" doesn't match sheet_title of any sheet returned by gs_ls() (which  should reflect user's Google Sheets home screen). 
    > browser <- gs_title("Funnel Daily") 
Error in gs_lookup(., "sheet_title", verbose) : 
    "Funnel Daily" doesn't match sheet_title of any sheet returned by gs_ls() (which should reflect user's Google Sheets home screen).` 

如果使用gl_ls()我得到了我所也经常使用谷歌帐户信息。那么有没有办法通过令牌或左右来区分账户或我如何解决这个问题issue。我的意思是我如何强制googlesheets访问某个特定的帐户? 当前我使用与Funnel Daily对应的帐户的token。我能想到的唯一可能导致这个问题的可能性是,浏览器认证是用不包括Funnel Daily的帐户完成的。我只是把它们混淆了。 我试图删除所有依赖关系的googlesheets以及httr。但是,在运行library(googlesheets)并询问gs_user时,Google表格始终指不包含特定工作表的帐户。

+0

'gs_auth'返回一个 “令牌”。每个令牌可以保存到一个R数据文件,然后传递_to_调用到'gs_auth'来更改当前会话的内部保存的令牌。您可能在使用'googlesheets'后缓存凭据,并且缓存文件应该位于主目录中的'.httr-oauth'。 – hrbrmstr

回答

0

包括您的凭据,并确认通过您的漏斗日报谷歌帐户的browser authentication

options(googlesheets.client_id = "", 
    googlesheets.client_secret = "", 
    googlesheets.httr_oauth_cache = FALSE) 

gs_auth(token = NULL, new_user = FALSE, 
    key = getOption("googlesheets.client_id"), 
    secret = getOption("googlesheets.client_secret"), 
    cache = getOption("googlesheets.httr_oauth_cache"), verbose = TRUE) 

干杯

+0

Thx.That完美的工作! – Googme

相关问题