开发者

RGoogleDocs authentication failure

Here's the deal: I've installed RGoogleDocs package from OmegaHat repository and everything worked fine during installation, but when I try to load specific document (spreadsheet) it states that I'm unauthorised!

I did:

# installation
install.packages("RGoogleDocs", repos = "http://www.omegahat.org/R")
library(RGoogleDocs)
auth <- getGoogleAuth("username@gmail.com", "开发者_运维技巧password")
con <- getGoogleDocsConnection(auth)
docs <- getDocs(con)
dtf <- getDocContent("documentname", con)
Error: Unauthorized

What's interesting here is that I can list all documents (I'm authorised to do that), but I'm not authorised to load any! O_o If I type names(docs) names of the documents appear, but I can't get their content! The same stands for "the spreadsheet method" stated on an official help page:

sheets.con <- getGoogleDocsConnection(getGoogleAuth("username@gmail.com", "password", service = "wise"))
> a <- getDocs(sheets.con)
Error in getDocs(sheets.con) : 
  problems connecting to get the list of documents


RGoogleDocs is a poorly-supported hack (and you can quote me on that), but it's the only tool for the job, sadly. I suspect you're using version 0.4-0, the latest version on the OmegaHat web page, right? Well, for access to the content of Google Spreadsheets, you actually need 0.4-1, which is available at this URL: http://www.omegahat.org/RGoogleDocs/RGoogleDocs_0.4-1.tar.gz.

That may work. There are some issues, though. I ran across one where a feature in the Google Docs API, to increase the number of rows in a spreadsheet, is not exposed via this package. So you can't add content beyond the number of existing rows, except by manually logging in and clicking the "add rows" button.

If you have the time and resources to fork the RGoogleDocs package and update it to use the current version of the API, including all features, I will seriously buy you some damn good beer if you're ever in NYC!


Some time ago I got into the same problem.

My solution to it was to publish the file, and then access it through the url (I gave a bunch of links how to do it here)

But I fear this is the best I know of at this point.


Here's a solution:

https://raw.github.com/tyhenkaline/forSharing/master/googleDriveData.R

For the test to work just enter your gmail credentials into the code and create a google drive spreadsheet called "Test RGoogleData" with at least 2 columns of data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜