问题
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