Skip to contents

Reads one sheet (or all sheets) from each of the Excel files in a folder and creates a list of pivot_table objects, one from each sheet. Each sheet is expected to contain a pivot table. Each line in a file corresponds to a row in a table. File and sheet names are included as part of each object attributes.

Usage

read_excel_folder(
  folder,
  sheetIndex = 1,
  sheetName = NULL,
  allSheets = FALSE,
  define_page = 3,
  page_sep = ":"
)

Arguments

folder

A string, folder name.

sheetIndex

A number, sheet index in the workbook.

sheetName

A string, sheet name.

allSheets

A boolean.

define_page

A integer, 0: no page, 1: file name as page, 2: sheet name as page, 3: file and sheet names as page, separated by the indicated separator.

page_sep

A string, separator to form the page value.

Value

A pivot_table object list.

Details

When multiple files or sheets are handled, the file and/or sheet names may contain information associated with the pivot table, they could be the table page information. In order not to lose this information, they are always stored in each pivot_table object.

See also

Examples

folder <- system.file("extdata", "excelfolder", package = "flattabler")
lpt <- read_excel_folder(folder)

lpt <- read_excel_folder(folder, allSheets = TRUE)