I'm using the following code:
setwd("~/R/Test")
require(openxlsx)
file_list <- list.files(getwd())
for (file in file_list){
file = read.xlsx(file)
write.csv(file,file=file)
}
Where it opens each file in a directory, reads the excel file, and saves as a CSV. However, I'm trying to source the original file name, and save the CSV with the original file name. Is there a way to do this?
Thanks!
file, which used to contain the original file name, in the linefile = read.xlsx(file). Just avoid doing that.