loadWorkbook {openxlsx} | R 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)

### Arguments

`file` | A path to an existing .xlsx or .xlsm file
`xlsxFile` | alias for file

### Value

Workbook object.

### Author(s)

Alexander Walker

### See Also

`removeWorksheet`

### Examples

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

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

[Package openxlsx version 4.1.0 Index]