clearSheet-methods

0th

Percentile

Clearing worksheets in a workbook

Clears worksheets with specified names or indices in a '>workbook.

Keywords
methods, utilities
Usage
# S4 method for workbook,numeric
clearSheet(object, sheet)
  # S4 method for workbook,character
clearSheet(object, sheet)
Arguments
object

The '>workbook to use

sheet

The name or the index of the worksheet to clear

Details

Clearing a worksheet means to clear all the cells in that worksheet. Consequently, the saved workbook should be smaller in size. Clearing a worksheet can be useful if data sets in a worksheet need to be replaced, i.e. data are first read, modified in R and finally written back to the worksheet. Without clearing the worksheet first, (parts of) the original data may still be visible if they occupied a larger range of the worksheet.

See Also

'>workbook, clearNamedRegion, clearRange, clearRangeFromReference

Aliases
  • clearSheet
  • clearSheet-methods
  • clearSheet,workbook,numeric-method
  • clearSheet,workbook,character-method
Examples
# NOT RUN {
# mtcars xlsx file from demoFiles subfolder of 
# package XLConnect
demoExcelFile <- system.file("demoFiles/mtcars.xlsx", 
                             package = "XLConnect")

# Load workbook
wb <- loadWorkbook(demoExcelFile)

# Clear worksheets named 'mtcars' and 'mtcars2'
clearSheet(wb, sheet = c("mtcars", "mtcars2"))

# Clear 3rd worksheet
clearSheet(wb, sheet = 3) 
# }
Documentation reproduced from package XLConnect, version 0.2-14, License: GPL-3

Community examples

Looks like there are no examples yet.