我想读取Excel文件并将其加载到我的环境中,我只是得到一个列表。
path <- "data/data.xlsx"
path %>%
excel_sheets() %>%
set_names() %>%
map(read_excel, path = path)
答案 0 :(得分:1)
您可以尝试: 在此示例中,我制作了3张xlsx。
library(readxl)
# Get the sheets count
sheets <- excel_sheets("some.xlsx")
for (i in 1 : length(sheets)) {
shts <- paste("x", i, sep = ".")
# Read every single sheet and assign to variable x1, x2, x3 etc...
assign(shts, read_excel("c:/Temporal/TEST.xlsx", sheet=sheets[i]))
}
结果:
我希望这会有所帮助!