Open hjia222 opened 3 years ago
cols = c(5, 10, 15) should apply the drop down list to coulmns 5, 10, 15
cols = c(5, 10, 15) applied the drop down list to coulmns 5:15
library(openxlsx) df <- bind_cols(iris, iris, iris) # create workbook wb <- createWorkbook() # initialize worksheet addWorksheet( wb = wb, sheetName = "Sheet1" ) # add df to Sheet1 writeData( wb = wb , sheet = "Sheet1" , x = df ) ## Add dropdown list addWorksheet(wb, "comment values") comment <- data.frame(comments = unique(iris$Species)) col_n <- which(str_detect(names(df), "Species")) writeData(wb, sheet = "comment values", comment, startCol = 1) dataValidation(wb, 1, cols = col_n, rows = 2:(nrow(df)+1), type = "list", value = "'comment values'!$A$2:$A$4") openXL( file = wb )
Could you please create this also at ycphs/openxlsx?
I am maintaining the active fork of the package.
Just did, thanks!
Expected Behavior
cols = c(5, 10, 15) should apply the drop down list to coulmns 5, 10, 15
Actual Behavior
cols = c(5, 10, 15) applied the drop down list to coulmns 5:15
Steps to Reproduce the Problem
sessionInfo()