If I run code from the openxlsx vignette, pasted below, and open the file, it displays correctly but Excel considers it a Custom format. Can anyone explain why and how to get Excel to recognize it as a Date datatype?
# data.frame of dates
dates <- data.frame(d1 = Sys.Date() - 0:4)
for (i in 1:3) dates <- cbind(dates, dates)
names(dates) <- paste0("d", 1:8)
## Date Formatting
wb <- createWorkbook()
addWorksheet(wb, "Date Formatting", gridLines = FALSE)
writeData(wb, 1, dates) ## write without styling
## numFmt == 'DATE' will use the date format specified by the above
addStyle(wb, 1, style = createStyle(numFmt = "DATE"), rows = 2:11, cols = 1, gridExpand = TRUE)
saveWorkbook(wb, "Date Formatting.xlsx", overwrite = TRUE)