Learn R Programming

XLConnect (version 1.1.0)

workbook-class: Class "workbook"

Description

This is XLConnect's main entity representing a Microsoft Excel workbook. S4 objects of this class and corresponding methods are used to manipulate the underlying Excel workbook instances.

Arguments

Objects from the Class

Objects can be created by calls of the form loadWorkbook(filename, create). This is a shortcut form of new("workbook", filename, create) with some additional error checking.

Slots

filename:

Object of class character which represents the filename of the underlying Microsoft Excel workbook.

jobj:

Object of class jobjRef (see package rJava) which represents a Java object reference that is used in the back-end to manipulate the underlying Excel workbook instance.

Note: The jobj slot should not be accessed directly. workbook objects should only be manipulated via the corresponding methods.

Author

Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch

References

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

See Also

loadWorkbook, saveWorkbook

Examples

Run this code
if (FALSE) {
# Create a new workbook 'myWorkbook.xlsx' 
# (assuming the file to not exist already)
wb <- loadWorkbook("myWorkbook.xlsx", create = TRUE)

# Create a worksheet called 'mtcars'
createSheet(wb, name = "mtcars")

# Write built-in dataset 'mtcars' to sheet 'mtcars' created above
writeWorksheet(wb, mtcars, sheet = "mtcars")

# Save workbook - this actually writes the file 'myWorkbook.xlsx' to disk
saveWorkbook(wb)

# clean up 
file.remove("myWorkbook.xlsx")
}

Run the code above in your browser using DataLab