将文件从 Sharepoint 导入 R [英] Import file from Sharepoint to R

查看:71
本文介绍了将文件从 Sharepoint 导入 R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我公司的 Sharepoint 站点访问 Excel 文件.我查看了 Stack Overflow 上关于 R 和 Sharepoint 的所有答案,结果空手而归.

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.

这目前对我有用:

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

但是,我不知道如何将其放入数据框中.此外,我真的希望这适用于扩展名为 .xlsb 的文件.

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 = "," 
) 

我收到 X401 未经授权的错误

I get a X401 Unauthorized error

任何帮助将不胜感激.

推荐答案

明白了!.xlsb 不起作用,但 .xlsx 和 .csv 工作正常.此外,我需要在共享点的 URL 末尾添加?Web=0"扩展名.

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.

这篇关于将文件从 Sharepoint 导入 R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆