Using the name= parameter in the writeData function in the openxlsx package creates a named range in Excel. This name does not seem usable because there is no worksheet associated with the name. Here is the example R code that creates the spreadsheet:
library(openxlsx)
wb<-createWorkbook()
wks<-"Example"
addWorksheet(wb, wks)
writeData(wb,wks,x="A Cell",
startCol = 1, startRow = 1, name="ExampleRangeName")
saveWorkbook(wb,file="example.xlsx",overwrite = TRUE)
The example.xlsx workbook contains a named range that refers to "=NA!$A$1:$A$1". It should refer to "=Example!$A$1:$A$1". Any suggestions how to make this work? Thanks.