View source: R/writeNamedRegionToFile.R
writeNamedRegionToFile | R Documentation |
Writes named regions to an Excel file.
writeNamedRegionToFile(file, data, name, formula=NA, ..., worksheetScope = NULL,
styleAction = XLC$STYLE_ACTION.XLCONNECT, clearNamedRegions=FALSE)
file |
The path name of the file to write to |
data |
Data to write |
name |
Name of the named region to write to |
formula |
If formula is specified, each item defines the formula of
the named region identified by the corresponding entry of
|
worksheetScope |
Optional character vector with worksheet name(s) to limit the scope in
which the |
... |
Additional arguments passed to |
styleAction |
Style action to be used when writing the data. |
clearNamedRegions |
TRUE to clear content of existing named regions before writing data |
Thomas Themel
Mirai Solutions GmbH https://mirai-solutions.ch
writeNamedRegion
,
writeWorksheetToFile
,
readNamedRegionFromFile
,
readWorksheetFromFile
## Not run:
# multiregion xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/multiregion.xlsx",
package = "XLConnect")
template <- "template-ws.xlsx"
file.copy(demoExcelFile, template)
# Write single data.frame to a named region in an existing file
writeNamedRegionToFile(template, name = "Iris", iris)
# Write to a new file, defining the sheet and named region as we write.
# Format according to XLConnect defaults
writeNamedRegionToFile("iris.xlsx", name = "Iris", data = iris,
formula = "IrisData!$C$4",
styleAction = "XLCONNECT")
# clean up
file.remove("iris.xlsx")
file.remove("template-ws.xlsx")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.