How to change tab color for existing worksheet? #1096
Answered
by
JanMarvin
evan8daniels
asked this question in
Q&A
-
After combing through documentation for both openxlsx and openxlsx2, I can't seem to find any function that allows for changes to a tab color for an existing worksheet, though there are options for adding new worksheets and assigning colors to them. I would really appreciate any help. Thanks so much. |
Beta Was this translation helpful? Give feedback.
Answered by
JanMarvin
Aug 2, 2024
Replies: 1 comment 15 replies
-
Hi @evan8daniels , you can set the tab color in library(openxlsx2)
# create a workbook with three sheets, set one upon creation and two afterwards
wb <- wb_workbook()$
add_worksheet("S1")$
add_worksheet("S2", tab_color = "blue")$
add_worksheet()$
set_page_setup(tab_color = wb_color("red"))$
set_page_setup("S1", tab_color = wb_color("green"))
if (interactive()) wb$open() |
Beta Was this translation helpful? Give feedback.
15 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If - for whatever kind of reason you cannot update your
openxlsx2
package - you could experiment with the following:This should work, but there might already be content in
wb$worksheets[[1]]$sheetPr
, so be careful and we have so many features and bugfixes, that an update to the latest release would be a huge benefit!