list.files()
lists all the files in a directory, use this with lapply()
and read_xlsx()
. In this example I set the working directory to the folder containing the files.
library(readxl)
files <- list.files()
dat <- lapply(files, read_xlsx)
dat
# [[1]]
# # A tibble: 1 x 3
# a a__1 a__2
# <dbl> <dbl> <dbl>
# 1 1 1 1
#
# [[2]]
# # A tibble: 1 x 3
# b b__1 b__2
# <dbl> <dbl> <dbl>
# 1 2 2 2
#
# [[3]]
# # A tibble: 1 x 3
# c c__1 c__2
# <dbl> <dbl> <dbl>
# 1 3 3 3
0
solved Creating a list of multiple excel files that have been converted to dataframes [closed]