问题描述
我正在尝试打开一个.xls,它在第1行中具有列名称,但在第2行和第3行中具有名称的其他部分。第2行和第3行中的某些单元格为空白。
library(readxl)
# This doesn't work
read_excel(dest)
# This doesn't work
read_excel(dest,skip = 3,col_names = FALSE)
# ... nor this
read_excel(dest,n_max = 1,col_names = TRUE)
# This works on manually modified file content (lines 2 and 3 deleted)
read_excel('../data/downloaded_FLEET2.xls',sheet = 1)
# This works on file that was manually converted to xlsx (Note: lines 2 and 3 still present)
read_excel('../data/downloaded_FLEET.xlsx',sheet = 1)
# This works on file that was manually converted to csv and back into xls (Note: lines 2 and 3 still present)
read_excel('../data/downloaded_FLEET3.xls',sheet = 1)
有什么想法吗?我真的想避免任何手动干预。
谢谢
解决方法
由于.xlsx工作正常,因此我将尝试使用其他库,例如openxlsx::read.xlsx
。