Learn R Programming

XLConnect (version 0.2-9)

saveWorkbook-methods: Saving Microsoft Excel workbooks

Description

Saves a workbook to the corresponding Excel file. This method actually writes the workbook object to disk.

Usage

## S3 method for class 'workbook,missing':
saveWorkbook(object,file)
## S3 method for class 'workbook,character':
saveWorkbook(object,file)

Arguments

object
The workbook to save
file
The file to which to save the workbook ("save as"). If not specified (missing), the workbook will be saved to the workbook's underlying file which is the file specified

Details

Saves the specified workbook object to disk.

See Also

workbook, loadWorkbook

Examples

Run this code
# Create a new workbook 'saveMe.xlsx'
# (assuming the file to not exist already)
wb <- loadWorkbook("saveMe.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 'saveMe.xlsx' to disk
saveWorkbook(wb)

Run the code above in your browser using DataLab