Import file from Sharepoint to R

青春壹個敷衍的年華 提交于 2021-01-28 03:16:29

问题


I am trying to access an Excel file from my company's Sharepoint site. I've looked into all the answers on Stack Overflow regarding R and Sharepoint and came up empty handed.

This currently works for me:

r <- GET("http://company.SharepointSite.com/Test.xlsx", authenticate("user", "pswd", "ntlm")) 

However, I have no idea how to get this into a data frame. Moreover, I really would like this to work for files with the .xlsb extension.

Now, when I tried this:

sharepoint_data <- read.table(
  text = getURL(
    csv_url,
    userpwd = paste0(username, ":", password)
  ),
  header = TRUE, 
  sep = "," 
) 

I get a X401 Unauthorized error

Any help would be much appreciated.


回答1:


Got it! .xlsb did not work but .xlsx and .csv work fine. Moreover, I needed the "?Web=0" extension at the end of my url for the sharepoint.



来源:https://stackoverflow.com/questions/52997555/import-file-from-sharepoint-to-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!