Skip to contents

Reads an Excel file sheet and creates a pivot_table object. The sheet is expected to contain one or more pivot tables. Each line in the sheet corresponds to a row in a table. The file and sheet names can be included as part of the object attributes.

Usage

read_excel_sheet(
  file,
  sheetIndex = 1,
  sheetName = NULL,
  define_page = 3,
  page_sep = ":"
)

Arguments

file

A string, name of an Excel file.

sheetIndex

A number, sheet index in the workbook.

sheetName

A string, sheet name.

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.

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 can be stored in the pivot_table object.

See also

Examples


file <- system.file("extdata", "excelfolder/m4.xlsx", package = "flattabler")
pt <- read_excel_sheet(file)

pt <- read_excel_sheet(file, sheetName = "Hoja2", define_page = 1)