ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
220 stars 74 forks source link

Is it possible to define formula1 in dataValidation when the type is list by giving a list of values rather than specifying a sheet range? Like #385

Closed JanMarvin closed 1 year ago

JanMarvin commented 1 year ago
    Is it possible to define formula1 in dataValidation when the type is list by giving a list of values rather than specifying a sheet range?  Like 

library(openxlsx) wb <- createWorkbook() addWorksheet(wb, "Sheet 1") addWorksheet(wb, "Sheet 2")

writeDataTable(wb, sheet = 1, x = iris[1:30, ]) writeData(wb, sheet = 2, x = sample(iris$Sepal.Length, 10))

dataValidation(wb, 1, col = 1, rows = 2:31, type = "list", value = "'option1,option2")

When I try to do this, I get an error in the resulting excel file.

Originally posted by @IRorpa in https://github.com/ycphs/openxlsx/issues/342#issuecomment-1256404432