来自在线网页 link 的 R read_excel 产生一个空数据框

R read_excel from online web page link produces an empty data frame

嗨,这是我第一次发帖, 我正在尝试从在线网页 link excel sheet 获取数据。但是,它适用于页面上的其他 link,但不适用于 returns 空白数据框的特定页面。

library(readxl)

download.file("https://www.parismou.org/sites/default/files/2016-04-DetentionLists_0.XLS","test.xls",mode="wb")
tbls=read_excel("test.xls")

将其下载为 .xls 文件可以正常工作,但无法阅读。 我也尝试过使用:

tbls=read.table("https://www.parismou.org/sites/default/files/2016-04-DetentionLists_0.XLS", header=TRUE, skipNul= TRUE) 

哪个returns:

Error in read.table("https://www.parismou.org/sites/default/files/2016-04-DetentionLists_0.XLS",  : 
  no lines available in input

我也尝试过 XLConnect 包,但它们返回了以下错误:

require(XLConnect)
download.file("https://www.parismou.org/sites/default/files/2016-04-DetentionLists_0.XLS","test.xls",mode="wb")
tblspx=loadWorkbook("test.xls")

Error: OldExcelFormatException (Java): The supplied spreadsheet seems to be Excel 5.0/7.0 (BIFF5) format. POI only supports BIFF8 format (from Excel versions 97/2000/XP/2003)

如有任何帮助,我们将不胜感激。

您正在处理一种非常古老的 excel 格式。 gdata 包可以解决这个问题(参见 SO post):

install.packages("gdata")
require(readxl)

download.file("https://www.parismou.org/sites/default/files/2016-04-DetentionLists_0.XLS","test.xls",mode="wb")

tbls = gdata::read.xls("test.xls", fileEncoding="latin1")