嗨,这是我第一次发帖, 我正在尝试从在线网页链接Excel工作表中获取数据。但是,它适用于页面上的其他链接,但不适用于返回空白数据框的特定链接。
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)
返回:
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)
任何帮助将不胜感激。
答案 0 :(得分:2)
您正在处理一个非常旧的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")