« useR! 2014 conference update | Main | A million new R users »

June 03, 2014


Feed You can follow this conversation by subscribing to the comment feed for this post.

You can actually force googledocs to give you a csv, the option is just not in the menus.


inserting your unique key inplace of 'KEY'. You can then just pull it into R with RCurl:


url <- https://docs.google.com/spreadsheets/d/KEY/export?format=csv&id=KEY

myCsv <- getURL(url,.opts=list(ssl.verifypeer=FALSE))
test <- read.csv(textConnection(myCsv))

Good alternative method though. Especially as I haven't figured out how to tab through multiple sheets within a single document.

Hi, Jack

Yes, I'm aware of this method. But this also seemed to have changed with the new version of Google Spreadsheets.

I tried this with my URL:

url <- "https://docs.google.com/spreadsheets/d/1MQ50_tn76GqQAOpFigcHms4zFqkoM_JS4sOittv_vgA/export?format=csv&id=KEY"

myCsv <- getURL(url,.opts=list(ssl.verifypeer=FALSE))
test <- read.csv(textConnection(myCsv))

The result is not a useful data frame:

2 Moved Temporarily
5 Moved Temporarily
6 The document has moved here.

If you find a way of fixing this, I'd be most interested!


not working as mentioned please help.

Hi Andrie,

Interesting. Did you include your KEY in the URL twice?? (I noticed your URL still has the words KEY in it at the end). For some reason you need to include the key twice. I've just tried it on my system and it is working, and producing a useable data frame.

url <- "https://docs.google.com/spreadsheets/d/1MQ50_tn76GqQAOpFigcHms4zFqkoM_JS4sOittv_vgA/export?format=csv&id=1MQ50_tn76GqQAOpFigcHms4zFqkoM_JS4sOittv_vgA"

Your method is much slicker though!!

The comments to this entry are closed.

Search Revolutions Blog

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr