The sheets are being saved because of the write_csv function in read_then_csv. You can remove it to not save the csv.
path <- "Data/df.xlsx"
read_then_csv <- function(sheet, path) {
pathbase <- path %>%
basename() %>%
tools::file_path_sans_ext()
path %>%
read_excel(sheet = sheet)
}
For the next question, file is a list of tibbles. You can access certain elements of file by pluck, list indexing ($ name or [[ position ]]), or you can wrangle with a map_at using names or positions:
sheet1 <- file %>%
pluck(1) # this saves the first sheet as the tibble called sheet1
sheet1 <- file[[1]] # this also saves the first sheet as the tibble called sheet1
file <- file %>%
map_at(1, ~ .x %>% mutate(row = row_number())) # adds a column row to sheet 1, but saves changes within the list file