Created
May 28, 2019 22:08
-
-
Save edavidaja/f97ec41afda1bb04d7b01db3d04b28bb to your computer and use it in GitHub Desktop.
convert legacy xls files to xlsx files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(purrr) | |
xls_to_xlsx <- function(file) { | |
if (fs::path_ext(file) != "xls") { | |
stop("file must have extension xls") | |
} | |
sheets <- readxl::excel_sheets(file) | |
insheets <- map(sheets, ~readxl::read_excel(file, .x, col_names = FALSE)) | |
insheets <- set_names(insheets, sheets) | |
outfile <- fs::path_ext_set(file, "xlsx") | |
writexl::write_xlsx(insheets, outfile, col_names = FALSE) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment