| createName-methods {XLConnect} | R Documentation |
Creating names in a workbook
Description
Creates a name for a specified formula in a workbook.
Usage
## S4 method for signature 'workbook'
createName(object, name, formula, overwrite)
Arguments
object |
The |
name |
The name's name to create |
formula |
Excel formula specifying the name |
overwrite |
If a name with the same |
Details
Creates a name named name for the specified formula.
The formula should be specified as you would type it
in Excel. Make sure that the worksheets, functions, ...
exist that you are referring to in the formula.
The name, formula and overwrite arguments are
vectorized such that multiple names can be created in one method call.
Author(s)
Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch
References
What are named regions/ranges?
https://www.officearticles.com/excel/named_ranges_in_microsoft_excel.htm
How to create named regions/ranges?
https://www.youtube.com/watch?v=iAE9a0uRtpM
See Also
workbook,
removeName,
existsName,
getDefinedNames,
readNamedRegion,
writeNamedRegion
Examples
## Not run:
# Load workbook (create if not existing)
wb <- loadWorkbook("createName.xlsx", create = TRUE)
# Create a worksheet named 'mtcars'
createSheet(wb, name = "mtcars")
# Create a named region called 'mtcars' on the sheet called 'mtcars'
createName(wb, name = "mtcars", formula = "mtcars!$A$1")
# Write built-in data set 'mtcars' to the above defined named region
writeNamedRegion(wb, mtcars, name = "mtcars")
# Save workbook
saveWorkbook(wb)
# clean up
file.remove("createName.xlsx")
## End(Not run)