appendWorksheet-methods: Appending data to worksheets

Description Usage Arguments Details Author(s) See Also Examples

Description

Appends data to worksheets of a workbook.

Usage

1
2
3
4
## S4 method for signature 'workbook,ANY,character'
appendWorksheet(object,data,sheet,header,rownames)
## S4 method for signature 'workbook,ANY,numeric'
appendWorksheet(object,data,sheet,header,rownames)

Arguments

object

The workbook to write to

data

Data to append

sheet

The name or index of the sheet to append the data to

header

Specifies if the column names should be written. The default is TRUE.

rownames

Name (character) of column to use for the row names of the provided data object. If specified, the row names of the data object (data.frame) will be included as an additional column with the specified name. If rownames = NULL (default), no row names will be included.

Details

Appends data to the worksheet specified by sheet. Data will be appended at the bottom and left most column containing some data. If more complex "appending schemes" are required you may make direct use of writeWorksheet.

Author(s)

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

See Also

workbook, writeWorksheet, readWorksheet, writeNamedRegion, appendNamedRegion, readNamedRegion

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# mtcars xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/mtcars.xlsx", package = "XLConnect")

# Load workbook
wb <- loadWorkbook(demoExcelFile)

# Append mtcars data set to worksheet named 'mtcars'
appendWorksheet(wb, mtcars, sheet = "mtcars")

## End(Not run)

Example output

Loading required package: XLConnectJars
XLConnect 0.2-15 by Mirai Solutions GmbH [aut],
  Martin Studer [cre],
  The Apache Software Foundation [ctb, cph] (Apache POI),
  Graph Builder [ctb, cph] (Curvesapi Java library)
http://www.mirai-solutions.com
https://github.com/miraisolutions/xlconnect

XLConnect documentation built on Oct. 1, 2021, 5:06 p.m.