首页 > 解决方案 > 在 r 中打开/读取 excel 文件

问题描述

我无法打开/阅读使用 readxl 从澳大利亚统计局网站下载的 excel 文件。

我已经从网站下载了表 12,但是当我去阅读工作簿的工作表时,r我收到一条错误消息:

library(readxl)    
excel_sheets(path = "C:/Users/Name/Documents/downloaded_file.xls")

"Error in xls_sheets(path) : Failed to open C:/Users/Name/Documents/downloaded_file.xls".

在以前的版本中,readxl我可以毫无困难地将这些文件读入r,但我最近更新了我的 readxl 版本,经过几个月的中断,现在它不起作用了。

我曾尝试使用download.file注意设置的功能下载文件,mode = wb但这对于访问工作簿中的数据也没有影响。

感谢任何指针。

标签: rexcelreadxl

解决方案


它适用于 Windows:

library(readxl)    
excel_sheets(path = "C:/Users/Name/Documents/downloaded_file.xls")
data<-readxl::read_excel(path = ""C:/Users/Name/Documents/downloaded_file.xls"",sheet = "Data1")

推荐阅读