read_excel_all: Read all sheets in an excel file

Description Usage Arguments Value See Also Examples

View source: R/read_excel_all_sheets.R

Description

This function pulls in all sheets in an excel document. It passes the same arguments for every sheet. Thefore it is best used on excel files where the sheets have identical layouts but have split the data into separate sheets by some grouping characteristic (e.g. state, year, company). An additional column (name controlled by 'sheet_id' paramater) tracks the name of each sheet in the returned tibble.

It takes all the parameters of read_excel EXCEPT 'sheet', the list of sheets is obtained through a call to 'readxl::excel_sheets()'. Future versions of this function should include a 'sheets' parameter to allow the user to specify explicitly which sheets to read.

Stackoverflow for help building the function: https://stackoverflow.com/q/58243710/3373438

Usage

1
read_excel_all(path, ..., sheet_id = ".sheet")

Arguments

path

Path to the xls/xlsx file

...

all arguments to readxl::read_excel() EXCEPT sheet. If you try to explicitly use a sheet param the function will break.

sheet_id

default = ".sheet": name of column that contains the sheet_name

Value

a tibble

See Also

read_excel

Examples

1
read_excel_all(readxl::readxl_example("datasets.xlsx"), n_max = 2)

williamlief/liefTools documentation built on Jan. 1, 2020, 6:48 p.m.