xlsxFile <- system.file("extdata", "readTest.xlsx", package = "openxlsx2")
df1 <- read_xlsx(xlsxFile = xlsxFile, sheet = 1, skipEmptyRows = FALSE)
sapply(df1, class)
df2 <- read_xlsx(xlsxFile = xlsxFile, sheet = 3, skipEmptyRows = TRUE)
df2$Date <- convert_date(df2$Date)
sapply(df2, class)
head(df2)
df2 <- read_xlsx(
xlsxFile = xlsxFile, sheet = 3, skipEmptyRows = TRUE,
detectDates = TRUE
)
sapply(df2, class)
head(df2)
wb <- wb_load(system.file("extdata", "readTest.xlsx", package = "openxlsx2"))
df3 <- read_xlsx(wb, sheet = 2, skipEmptyRows = FALSE, colNames = TRUE)
df4 <- read_xlsx(xlsxFile, sheet = 2, skipEmptyRows = FALSE, colNames = TRUE)
all.equal(df3, df4)
wb <- wb_load(system.file("extdata", "readTest.xlsx", package = "openxlsx2"))
df3 <- read_xlsx(wb,
sheet = 2, skipEmptyRows = FALSE,
cols = c(1, 4), rows = c(1, 3, 4)
)
Run the code above in your browser using DataLab