loadWorkbook: Load an existing .xlsx file

View source: R/loadWorkbook.R

loadWorkbookR Documentation

Load an existing .xlsx file

Description

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

Usage

loadWorkbook(file, xlsxFile = NULL, isUnzipped = FALSE, na.convert = TRUE)

Arguments

file

A path to an existing .xlsx or .xlsm file

xlsxFile

alias for file

isUnzipped

Set to TRUE if the xlsx file is already unzipped

na.convert

Should empty/blank cells be converted to NA_character_. Defaults to TRUE.

Value

Workbook object.

Author(s)

Alexander Walker, Philipp Schauberger

See Also

removeWorksheet()

Examples

## load existing workbook from package folder
wb <- loadWorkbook(file = system.file("extdata", "loadExample.xlsx", package = "openxlsx"))
names(wb) # list worksheets
wb ## view object
## Add a worksheet
addWorksheet(wb, "A new worksheet")

## Save workbook
## Not run: 
saveWorkbook(wb, "loadExample.xlsx", overwrite = TRUE)

## End(Not run)


openxlsx documentation built on Sept. 20, 2024, 5:08 p.m.