R/read_all_excel.R

Defines functions read_excel_allsheets

Documented in read_excel_allsheets

## Read all worksheets in an Excel workbook into an R list with data.frames

#' @title Read all worksheets 
#' @param filename
#' @param tibble
#' @export
#' @examples

read_excel_allsheets <- function(filename, tibble = FALSE) {
  sheets <- readxl::excel_sheets(filename)
  x <- lapply(sheets, function(X) readxl::read_excel(filename, sheet = X))
  if(!tibble) x <- lapply(x, as.data.frame)
  names(x) <- sheets
  x
}
saschariaz/saschaR documentation built on May 6, 2020, 5:27 p.m.