Skip to content

How to modifying a data table with openxlsx2? #1092

Answered by JanMarvin
maximecharriere asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @maximecharriere , you could try something like the code below, but be aware, with tables updates are always a bit risky, because there might be filters and slicers attached to a table and they are not updated (I believe there is a warning with wb_update_table() regarding this). So if the table is sorted, the sorting will not automatically update. And elements that are not selected are simply hidden in xml, this is also not updated. Therefore with filters there might be additional issues.

library(openxlsx2)

# prepare example data
df <- data.frame(
  COL_1 = 1:4,
  COL_2 = c("foo", "boo", "foo", "boo"),
  COL_3 = letters[1:4]
)

# prepare example workbook
wb <- wb_workbook()$
  add_wor…

Replies: 1 comment 3 replies

Comment options

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

@JanMarvin
Comment options

@maximecharriere
Comment options

Answer selected by maximecharriere
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