将受密码保护的 xlsx 文件导入 R

问题描述

我发现一个旧线程 (How do you read a password protected excel file into r?) 建议我使用以下代码读取受密码保护文件

install.packages("excel.link")

library("excel.link")

dat <- xl.read.file("TestWorkbook.xlsx",password = "pass",write.res.password="pass")

dat

但是,当我尝试这样做时,我的 R 立即崩溃了。我试过删除 write.res.password 参数,这似乎不是问题。我有一种预感,excel.link 可能不适用于最新版本的 R,因此如果您知道任何其他方法可以做到这一点,我将不胜感激。

编辑:使用 read.xlsx 生成错误

    Error in .jcall("RJavaTools","Ljava/lang/Object;","newInstance",.jfindClass(class),: 
     
    org.apache.poi.poifs.filesystem.OfficeXmlFileException: 
The supplied data appears to be in the Office 2007+ XML. 
You are calling the part of POI that deals with OLE2 Office Documents. 
You need to call a different part of POI to process this data (eg XSSF instead of hssf)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)