writeWorksheetToFile: Writing data to worksheets in an Excel file (wrapper...

Description Usage Arguments Author(s) See Also Examples

View source: R/writeWorksheetToFile.R

Description

Writes data to worksheets in an Excel file.

Usage

1
2
writeWorksheetToFile(file, data, sheet, ..., styleAction = XLC$STYLE_ACTION.XLCONNECT, 
clearSheets = FALSE)

Arguments

file

The path name of the file to write to.

data

Data to write

sheet

The name or index of the sheet to write to

...

Additional arguments passed to writeWorksheet

styleAction

Style action to be used when writing the data - not vectorized! The default is XLC$STYLE_ACTION.XLCONNECT. See setStyleAction for more information.

clearSheets

TRUE to clear sheets before writing data.

Author(s)

Thomas Themel
Mirai Solutions GmbH http://www.mirai-solutions.com

See Also

writeWorksheet, writeNamedRegionToFile, readWorksheetFromFile,
readNamedRegionFromFile

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# multiregion xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/multiregion.xlsx",
                             package = "XLConnect")

# create a copy of the template
template <- "template-ws.xlsx"
file.copy(demoExcelFile, template) 

# Write single data.frame to a specified location in an existing file
writeWorksheetToFile(template, data=iris, sheet="FirstSheet",
                     startRow=9, startCol = 9)

# create a copy of the template
template <- "template-multi-ws.xlsx"

# Write a few copies of the data.frame all over a new file
writeWorksheetToFile(template, data = list(i1 = iris, i2 = iris, i3 = iris),
                     sheet = c("FirstSheet", "SecondSheet", "FirstSheet"),
                     startRow = c(1,101,201), startCol = c(1,11,21))

XLConnect documentation built on April 6, 2018, 1:03 a.m.