views:

72

answers:

2

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("[email protected]", "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("[email protected]", "password", service = "wise"))
> a <- getDocs(sheets.con)
Error in getDocs(sheets.con) : 
  problems connecting to get the list of documents
+3  A: 

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!

Harlan
And I will send 500g of the finest chocolate in the world right to you. Whole Foods here sells Barry Callebaut by the bulk block.
Farrel
Callebaut's good, particularly for cooking, but my personal favorite for eating is Michel Cluizel's Los Ancones. Incidentally, Farrel, you may be interested in the new Stack Exchange site http://cooking.stackexchange.com !
Harlan
+1  A: 

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.

Tal Galili
That works if you have a file you want to read (not write) and if the content is not confidential. RGoogleDocs lets you access cells as if they were a matrix or data frame! Great for building R-supported dashboards on the cheap!
Harlan
Thanks Tal, but unfortunately, spreadsheet data IS confidential, so this doesn't do the job! =(
aL3xa
Harlen - I plussed one you.aL3xa - sorry, I do understand...
Tal Galili