Learn R Programming

openxlsx2 (version 0.3.1)

wb_load: Load an existing .xlsx file

Description

wb_load returns a workbook object conserving styles and formatting of the original .xlsx file.

Usage

wb_load(file, xlsxFile = NULL, sheet, data_only = FALSE)

Value

Workbook object.

Arguments

file

A path to an existing .xlsx or .xlsm file

xlsxFile

alias for file

sheet

optional sheet parameter. if this is applied, only the selected sheet will be loaded.

data_only

mode to import if only a data frame should be returned. This strips the wbWorkbook to a bare minimum.

See Also

wb_remove_worksheet()

Examples

Run this code
## load existing workbook from package folder
wb <- wb_load(file = system.file("extdata", "loadExample.xlsx", package = "openxlsx2"))
wb$get_sheet_names() # list worksheets
wb ## view object
## Add a worksheet
wb$add_worksheet("A new worksheet")

Run the code above in your browser using DataLab