read_excel_file: Import Excel file

read_excel_fileR Documentation

Import Excel file

Description

Reads sheets from an Excel file and creates a pivot_table object list, one from each sheet. Each sheet is expected to contain a pivot table. Each line in a sheet corresponds to a row in a table. The file and sheet names are included as part of each object attributes.

Usage

read_excel_file(
  file,
  sheetIndexes = NULL,
  sheetNames = NULL,
  define_page = 3,
  page_sep = ":"
)

Arguments

file

A string, name of an Excel file.

sheetIndexes

A vector of numbers, sheet indexes in the workbook.

sheetNames

A vector of strings, sheet names.

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.

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.

Value

A pivot_table object list.

See Also

pivot_table

Other import functions: read_excel_folder(), read_excel_sheet(), read_text_file(), read_text_folder()

Examples

# file <- system.file("extdata", "excel/set_sheets.xlsx", package = "flattabler")
# lpt <- read_excel_file(file)

# lpt <- read_excel_file(file, sheetIndexes = 1:4)

# lpt <- read_excel_file(file, sheetNames = c("M1", "M2", "M3", "M4"))


flattabler documentation built on Sept. 15, 2023, 1:06 a.m.