Skip to content

Instantly share code, notes, and snippets.

@benmarwick
Last active December 11, 2015 18:19
Show Gist options
  • Save benmarwick/4640944 to your computer and use it in GitHub Desktop.
Save benmarwick/4640944 to your computer and use it in GitHub Desktop.
Use a google spreadsheet as data in R (with RCurl and options to support https)
# More detail: http://blog.revolutionanalytics.com/2009/09/how-to-use-a-google-spreadsheet-as-data-in-r.html and
# http://exploredata.wordpress.com/2012/08/20/importing-a-google-spreadsheet-into-r/
googsheet <- "full URL of google doc here, must end with &output=csv"
require(RCurl)
options(RCurlOptions = list(capath = system.file("CurlSSL", "cacert.pem", package = "RCurl"), ssl.verifypeer = FALSE))
myCsv <- getURL(googsheet)
data <- read.csv(textConnection(myCsv), stringsAsFactors = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment