excel_sheets: List all sheets in an excel spreadsheet

View source: R/excel-sheets.R

excel_sheetsR Documentation

List all sheets in an excel spreadsheet

Description

The list of sheet names is especially useful when you want to iterate over all of the sheets in a workbook. The vignette("readxl-workflows") article provides several worked examples of this, showing how to combine readxl with other packages in the tidyverse, such as purrr, or with base R functions like lapply().

Usage

excel_sheets(path)

Arguments

path

Path to the xls/xlsx file.

Examples

excel_sheets(readxl_example("datasets.xlsx"))
excel_sheets(readxl_example("datasets.xls"))

# To load all sheets in a workbook, use lapply()
path <- readxl_example("datasets.xls")
lapply(excel_sheets(path), read_excel, path = path)

readxl documentation built on July 9, 2023, 5:57 p.m.