2

I'm trying to bring in an excel file into R that is located on a secure company SharePoint site. So far, I have tried using RCurl to do this, and this is the code I have currently:

library(RCurl)
curl = getCurlHandle()
curlSetOpt(cookiejar = "cookies.txt",.opts = list(proxy = "proxy", proxyuserpwd = "username:password",
                                              proxyauth = "ntlm"), curl = curl, useragent = "Mozilla/5.0", followlocation = TRUE)
content <- getURL("URL", 
              curl = curl, httpauth = 1L, ssl.verifypeer = FALSE, verbose = TRUE , userpwd = "username:password")

After running this code, content contains html code from the SharePoint site. However, I do not know if this is what I want.

I want to be able to access the excel document and possibly bring it into a data frame in R. I know you can do this using XLConnect, but I am not sure if you can use XLConnect to pull a document from a secure webpage. Does anyone know how to solve this issue?

erasmortg
  • 3,246
  • 1
  • 17
  • 34
Myers333
  • 21
  • 3
  • Never ever do `ssl.verifypeer = FALSE` - it basically eliminates any benefit of using https in the first place. – hadley Jul 09 '15 at 16:10
  • @hadley If I set ssl.verifypeer = TRUE, then I get this error – Myers333 Jul 09 '15 at 16:16
  • Error in function (type, msg, asError = TRUE) : SSL certificate problem: unable to get local issuer certificate – Myers333 Jul 09 '15 at 16:16
  • If you don't understand how to correclty set up SSL on windows, I'd recommend using httr which does it automatically. Use `GET()` + `write_disk()` to save the file to disk, and then XLConnect (or `readxl`) to load it into R. – hadley Jul 09 '15 at 16:45
  • @hadley Sorry, I am new to this process. If I were to use GET(), what parameters would I need to pass to GET() besides the URL to save the file to disk? If I just pass the URL, I get the same error as above. Thanks for your help! – Myers333 Jul 09 '15 at 16:59
  • is this solved yet? – schlusie Aug 25 '16 at 15:22

0 Answers0