Skip to content

Feature: dropdown #1084

Answered by JanMarvin
Longfei2 asked this question in Q&A
Jul 17, 2024 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

There are various ways to create drop downs in openxlsx2, please have a look if these can solve your request:

library(openxlsx2)

gtcars <- gt::gtcars

make <- gtcars$mfr
car  <- gtcars$model

df <- data.frame(
  make, car
)

# there is some limit in MS365, maybe the string has to be < 254 characters?
list_sel <- paste0('"', paste0(car[1:32], collapse = ","), '"')
cat(list_sel)
#> "GT,458 Speciale,458 Spider,458 Italia,488 GTB,California,GTC4Lusso,FF,F12Berlinetta,LaFerrari,NSX,GT-R,Aventador,Huracan,Gallardo,Continental GT,Granturismo,Quattroporte,Ghibli,6-Series,i8,M4,M5,M6,DB11,Rapide S,Vanquish,Vantage,Corvette,Viper,R8,RS 7"

value_range <- paste0("'data'!", wb_dims(x = df, cols = "car"

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by JanMarvin
Comment options

You must be logged in to vote
3 replies
@JanMarvin
Comment options

@Longfei2
Comment options

@JanMarvin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1083 on July 17, 2024 09:00.