Learn R Programming

XLConnect (version 0.2-9)

loadWorkbook: Loading Microsoft Excel workbooks

Description

Loads or creates a Microsoft Excel workbook for further manipulation.

Usage

loadWorkbook(filename, create = FALSE)

Arguments

filename
Filename (absolute or relative) of Excel workbook to be loaded. Supported are Excel '97 (*.xls) and OOXML (Excel 2007+, *.xlsx) file formats. Paths are expanded using path.expand.
create
Specifies if the file should be created if it does not already exist (default is FALSE). Note that create = TRUE has no effect if the specified file exists, i.e. an existing file is loaded and not being recreated if c

Value

  • Returns a workbook object for further manipulation.

References

Wikipedia: Office Open XML http://en.wikipedia.org/wiki/Office_Open_XML

See Also

workbook, saveWorkbook

Examples

Run this code
# Load existing demo Excel file 'mtcars.xlsx' from the XLConnect package
wb.mtcars <- loadWorkbook(system.file("demoFiles/mtcars.xlsx", 
                          package = "XLConnect"))

# Create new workbook
wb.new <- loadWorkbook("myNewExcelFile.xlsx", create = TRUE)

# NOTE: The above statement does not write the file to disk! 
# saveWorkbook(wb.new) would need to be called in order to write/save 
# the file to disk!

Run the code above in your browser using DataLab