if (FALSE) {
# Load workbook; create if not existing
wb <- loadWorkbook("XLConnect.xlsx", create = TRUE)
# Create a worksheet
createSheet(wb, name = "mtcars")
# Create a name reference
createName(wb, name = "mtcars", formula = "mtcars!$C$5")
# Write built-in data.frame 'mtcars' to the specified named region
writeNamedRegion(wb, mtcars, name = "mtcars")
# Save workbook
saveWorkbook(wb)
# clean up
file.remove("XLConnect.xlsx")
}
Run the code above in your browser using DataLab