From 4324687cf73f63038dfdbd2bffadbb9595dbd328 Mon Sep 17 00:00:00 2001 From: JanMarvin Date: Thu, 23 Nov 2023 20:03:20 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20JanMarvi?= =?UTF-8?q?n/openxlsx2@ff44f24d9d9050779252e8bf53b39c8cad28ec44=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/pkgdown.yml | 2 +- dev/reference/properties-wb.html | 2 +- dev/search.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index 66863e482..2a5043800 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -8,7 +8,7 @@ articles: openxlsx2_charts_manual: openxlsx2_charts_manual.html openxlsx2_formulas_manual: openxlsx2_formulas_manual.html openxlsx2_style_manual: openxlsx2_style_manual.html -last_built: 2023-11-16T18:30Z +last_built: 2023-11-23T20:02Z urls: reference: https://janmarvin.github.io/openxlsx2/reference article: https://janmarvin.github.io/openxlsx2/articles diff --git a/dev/reference/properties-wb.html b/dev/reference/properties-wb.html index 2a6225e22..098610d19 100644 --- a/dev/reference/properties-wb.html +++ b/dev/reference/properties-wb.html @@ -147,7 +147,7 @@

Exampleswb$set_properties(title = "my title") wb$get_properties() #> creator modifier datetime_created -#> "Jan Marvin Garbuszus" "Jan Marvin Garbuszus" "2023-11-16T18:30:37Z" +#> "Jan Marvin Garbuszus" "Jan Marvin Garbuszus" "2023-11-23T20:02:30Z" #> datetime_modified title company #> "2023-05-29T10:47:37Z" "my title" "" diff --git a/dev/search.json b/dev/search.json index 6a6dd5630..7eea21fe6 100644 --- a/dev/search.json +++ b/dev/search.json @@ -1 +1 @@ -[{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"basic-read-and-write-functions","dir":"Articles","previous_headings":"","what":"Basic read and write functions","title":"Upgrade from openxlsx","text":"Welcome openxlsx2 update vignette. vignette take common code examples openxlsx show similar results can replicated openxlsx2. Thank taking look, let’s get started. previous openxlsx functions used . function calls, well camelCase, tried switch snake_case (still work progress, may still function arguments use camelCase).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"read-xlsx-or-xlsm-files","dir":"Articles","previous_headings":"Basic read and write functions","what":"Read xlsx or xlsm files","title":"Upgrade from openxlsx","text":"basic read function changed read.xlsx read_xlsx. Using default xlsx file included package: old syntax looked like : changed : can see, return spreadsheet return codes (e.g., #NUM) openxlsx2. Another thing see , return cell row rowname data frame returned. openxlsx2 return data frame selected size, even empty. preferred openxlsx::readWorkbook() become wb_read(). wrappers newly introduced function wb_to_df() provides options. read_xlsx() wb_read() created backward comparability.","code":"file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") # read in openxlsx openxlsx::read.xlsx(xlsxFile = file) # read in openxlsx2 openxlsx2::read_xlsx(file = file) ## Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 ## 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 ## 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 ## 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 ## 6 FALSE 2 NA #NUM! 2 17:24:53 ## 7 FALSE 3 NA 1.56 e ## 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 ## 9 NA NA NA ## 10 FALSE 2 NA 23 h 2023-12-24 25 ## 11 FALSE 3 NA 67.3 i 2023-12-25 3 ## 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"write-xlsx-files","dir":"Articles","previous_headings":"","what":"Write xlsx files","title":"Upgrade from openxlsx","text":"Basic writing openxlsx2 behaves identical openxlsx. Though aware overwrite optional parameter openxlsx2 just like functions like base::write.csv() write onto existing file name, file replaced. Setting output temporary xlsx file previous write function looks like : new function looks quite similar:","code":"output <- temp_xlsx() # write in openxlsx openxlsx::write.xlsx(iris, file = output, colNames = TRUE) # write in openxlsx2 openxlsx2::write_xlsx(iris, file = output, col_names = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"basic-workbook-functions","dir":"Articles","previous_headings":"","what":"Basic workbook functions","title":"Upgrade from openxlsx","text":"Workbook functions renamed begin wb_ plenty package, therefore looking man pages seems fastest way. Yet, begins loading workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"loading-a-workbook","dir":"Articles","previous_headings":"Basic workbook functions","what":"Loading a workbook","title":"Upgrade from openxlsx","text":"major feature openxlsx workbooks. Obviously remain central piece openxlsx2. Previous load : openxlsx2 loading changed : plenty functions interact workbooks describe every single one . detailed list can found references","code":"wb <- openxlsx::loadWorkbook(file = file) wb <- wb_load(file = file)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"styles","dir":"Articles","previous_headings":"Basic workbook functions","what":"Styles","title":"Upgrade from openxlsx","text":"One biggest user facing change removal stylesObject. following section use code openxlsx::addStyle() openxlsx2 code looks something like : code uses chaining. prefer piping, provide chained functions prefix wb_ wb_add_worksheet(), wb_add_data(), wb_add_border() wb_set_col_widths() functions use pipes %>% |>. pipes code becomes aware chains modify object place pipes . can re-use styles wb_get_cell_style() wb_set_cell_style(). Abandoning stylesObject openxlsx2 huge benefit can import export spreadsheet without changing cell style. still possible modify cell style wb_add_border(), wb_add_fill(), wb_add_font() wb_add_numfmt(). Additional examples regarding styles can found styles vignette.","code":"# openxlsx ## Create a new workbook wb <- createWorkbook(creator = \"My name here\") addWorksheet(wb, \"Expenditure\", gridLines = FALSE) writeData(wb, sheet = 1, USPersonalExpenditure, rowNames = TRUE) ## style for body bodyStyle <- createStyle(border = \"TopBottom\", borderColor = \"#4F81BD\") addStyle(wb, sheet = 1, bodyStyle, rows = 2:6, cols = 1:6, gridExpand = TRUE) ## set column width for row names column setColWidths(wb, 1, cols = 1, widths = 21) # openxlsx2 chained border_color <- wb_color(hex = \"4F81BD\") wb <- wb_workbook(creator = \"My name here\")$ add_worksheet(\"Expenditure\", grid_lines = FALSE)$ add_data(x = USPersonalExpenditure, row_names = TRUE)$ add_border( # add the outer and inner border dims = \"A1:F6\", top_border = \"thin\", top_color = border_color, bottom_border = \"thin\", bottom_color = border_color, inner_hgrid = \"thin\", inner_hcolor = border_color, left_border = \"\", right_border = \"\" )$ set_col_widths( # set column width cols = 1:6, widths = c(20, rep(10, 5)) )$ # remove the value in A1 add_data(dims = \"A1\", x = \"\") # openxlsx2 with pipes border_color <- wb_color(hex = \"4F81BD\") wb <- wb_workbook(creator = \"My name here\") %>% wb_add_worksheet(sheet = \"Expenditure\", grid_lines = FALSE) %>% wb_add_data(x = USPersonalExpenditure, row_names = TRUE) %>% wb_add_border( # add the outer and inner border dims = \"A1:F6\", top_border = \"thin\", top_color = border_color, bottom_border = \"thin\", bottom_color = border_color, inner_hgrid = \"thin\", inner_hcolor = border_color, left_border = \"\", right_border = \"\" ) %>% wb_set_col_widths( # set column width cols = 1:6, widths = c(20, rep(10, 5)) ) %>% # remove the value in A1 wb_add_data(dims = \"A1\", x = \"\") # openxlsx2 wbp <- wb_workbook() %>% wb_add_worksheet() wbc <- wb_workbook()$add_worksheet() # need to assign wbp wbp <- wbp %>% wb_add_data(x = iris) wbc$add_data(x = iris)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"conditional-formatting","dir":"Articles","previous_headings":"Basic workbook functions","what":"Conditional formatting","title":"Upgrade from openxlsx","text":"See vignette(\"conditional-formatting\") extended examples formatting. minimal example:","code":"# openxlsx2 with chains wb <- wb_workbook()$ add_worksheet(\"a\")$ add_data(x = 1:4, col_names = FALSE)$ add_conditional_formatting(dims = \"A1:A4\", rule = \">2\") # openxlsx2 with pipes wb <- wb_workbook() %>% wb_add_worksheet(\"a\") %>% wb_add_data(x = 1:4, col_names = FALSE) %>% wb_add_conditional_formatting(dims = \"A1:A4\", rule = \">2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"data-validation","dir":"Articles","previous_headings":"Basic workbook functions","what":"Data validation","title":"Upgrade from openxlsx","text":"Similarly, data validation updated improved. openxlsx code data validation looks openxlsx2 something like :","code":"# openxlsx wb <- createWorkbook() addWorksheet(wb, \"Sheet 1\") writeDataTable(wb, 1, x = iris[1:30, ]) dataValidation(wb, 1, col = 1:3, rows = 2:31, type = \"whole\", operator = \"between\", value = c(1, 9) ) # openxlsx2 with chains wb <- wb_workbook()$ add_worksheet(\"Sheet 1\")$ add_data_table(1, x = iris[1:30, ])$ add_data_validation(1, dims = wb_dims(rows = 2:31, cols = 1:3), # alternatively, dims can also be \"A2:C31\" if you know the span in your Excel workbook. type = \"whole\", operator = \"between\", value = c(1, 9) ) # openxlsx2 with pipes wb <- wb_workbook() %>% wb_add_worksheet(\"Sheet 1\") %>% wb_add_data_table(1, x = iris[1:30, ]) %>% wb_add_data_validation( sheet = 1, dims = \"A2:C31\", # alternatively, dims = wb_dims(rows = 2:31, cols = 1:3) type = \"whole\", operator = \"between\", value = c(1, 9) )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"saving","dir":"Articles","previous_headings":"Basic workbook functions","what":"Saving","title":"Upgrade from openxlsx","text":"Saving switched saveWorkbook() wb_save() opening workbook switched openXL() wb_open().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"why-openxlsx2","dir":"Articles","previous_headings":"","what":"Why openxlsx2?","title":"Upgrade from openxlsx","text":"Originally, openxlsx2 started private branch openxlsx include pugixml library provide fully functional XML parser openxlsx. time, became clear home-written openxlsx XML parser limited ability reliably parse XML files, leading problems broken unreadable xlsx files. inclusion pugixml addressed, new internal structure created, structure required changes old openxlsx functions. accompanied change methods R6 possibility chaining piping functions. Working styles object openxlsx became clear great idea, work well enough needs files loaded modified openxlsx never look . always things look little style objects work perfectly. Likewise, lot edge cases openxlsx assume file structure xlsx objects simplified approximation actually going . example, openxlsx assumes sheet accompanied drawing. works many cases, match definition format openxml standard. may worksheets multiple drawings, drawing folder drawings included. Unfortunately, many things deeply embedded openxlsx code, development took place openxlsx2, things differed fork origin. point fork called independent project previously privately developed branch made public. say went hand hand modification actual project goal. , creating similar looking xlsx file able partially edit . Now writing identical xlsx file just able change everything. Since internal functions openxlsx cleaned , fixed mostly rewritten. package developed new ways handle styles styles manager, provides full range style options hard impossible include openxlsx. included support native graphs mschart feature creation pivot tables. support conditional formatting options, improved support data validation, sparklines form control objects. addition many quirks old package ironed . switched consistent stable API build dims provide multiple vignettes document code plenty functions interact openxml format. provide basic xlsb support msoc created package encrypt decrypt openxml files.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"invitation-to-contribute","dir":"Articles","previous_headings":"","what":"Invitation to contribute","title":"Upgrade from openxlsx","text":"put lot work openxls2 make useful needs, improving found useful openxlsx removing didn’t need. claim omniscient things can spreadsheet software, claim omniscient things can openxlsx2. package still active development, though reached semi stable API change next major release. quite fond little package invite others try comment like course think missing something doesn’t work. openxlsx2 complex piece software certainly work bug-free, even best. want contribute development openxlsx2, please guest Github. Join open discussion, post fix issues write us mail.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"rule-applies-to-all-each-cell-in-range","dir":"Articles","previous_headings":"","what":"Rule applies to all each cell in range","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"cellIs\") wb$add_data(\"cellIs\", -5:5) wb$add_data(\"cellIs\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"cellIs\", dims = \"A1:A11\", rule = \"!=0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"cellIs\", dims = \"A1:A11\", rule = \"==0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-row-dependent-on-first-cell-in-row","dir":"Articles","previous_headings":"","what":"Highlight row dependent on first cell in row","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Moving Row\") wb$add_data(\"Moving Row\", -5:5) wb$add_data(\"Moving Row\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"Moving Row\", dims = \"A1:B11\", rule = \"$A1<0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Moving Row\", dims = \"A1:B11\", rule = \"$A1>0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-column-dependent-on-first-cell-in-column","dir":"Articles","previous_headings":"","what":"Highlight column dependent on first cell in column","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Moving Col\") wb$add_data(\"Moving Col\", -5:5) wb$add_data(\"Moving Col\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"Moving Col\", dims = \"A1:B11\", rule = \"A$1<0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Moving Col\", dims = \"A1:B11\", rule = \"A$1>0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-entire-range-cols-x-rows-dependent-only-on-cell-a1","dir":"Articles","previous_headings":"","what":"Highlight entire range cols X rows dependent only on cell A1","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Dependent on\") wb$add_data(\"Dependent on\", -5:5) wb$add_data(\"Dependent on\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"Dependent on\", dims = \"A1:B11\", rule = \"$A$1 < 0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Dependent on\", dims = \"A1:B11\", rule = \"$A$1>0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-cells-in-column-1-based-on-value-in-column-2","dir":"Articles","previous_headings":"","what":"Highlight cells in column 1 based on value in column 2","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_data(\"Dependent on\", data.frame(x = 1:10, y = runif(10)), startRow = 15) wb$add_conditional_formatting( \"Dependent on\", dims = \"A16:A25\", rule = \"B16<0.5\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Dependent on\", dims = \"A16:A25\", rule = \"B16>=0.5\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-duplicates-using-default-style","dir":"Articles","previous_headings":"","what":"Highlight duplicates using default style","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Duplicates\") wb$add_data(\"Duplicates\", sample(LETTERS[1:15], size = 10, replace = TRUE)) wb$add_conditional_formatting( \"Duplicates\", dims = \"A1:A10\", type = \"duplicatedValues\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-containing-text","dir":"Articles","previous_headings":"","what":"Cells containing text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") wb$add_worksheet(\"containsText\") wb$add_data(\"containsText\", sapply(1:10, fn)) wb$add_conditional_formatting( \"containsText\", dims = \"A1:A10\", type = \"containsText\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-not-containing-text","dir":"Articles","previous_headings":"","what":"Cells not containing text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") my_dat <- sapply(1:10, fn) wb$add_worksheet(\"notcontainsText\") wb$add_data(\"notcontainsText\", x = my_dat) wb$add_conditional_formatting( \"notcontainsText\", dims = wb_dims(x = my_dat), type = \"notContainsText\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-begins-with-text","dir":"Articles","previous_headings":"","what":"Cells begins with text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") wb$add_worksheet(\"beginsWith\") wb$add_data(\"beginsWith\", sapply(1:100, fn)) wb$add_conditional_formatting( \"beginsWith\", dims = \"A1:A100\", type = \"beginsWith\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-ends-with-text","dir":"Articles","previous_headings":"","what":"Cells ends with text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") wb$add_worksheet(\"endsWith\") wb$add_data(\"endsWith\", x = sapply(1:100, fn)) wb$add_conditional_formatting( \"endsWith\", dims = \"A1:A100\", type = \"endsWith\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"colorscale-colors-cells-based-on-cell-value","dir":"Articles","previous_headings":"","what":"Colorscale colors cells based on cell value","title":"Add conditional formatting to a workbook","text":"Yep, color scale image. Rule vector colors length 2 3 (hex color colors()). rule NULL, min max cells used. Rule must length style L.","code":"df <- read_xlsx(\"https://github.com/JanMarvin/openxlsx-data/raw/main/readTest.xlsx\", sheet = 5) wb$add_worksheet(\"colorScale\", zoom = 30) wb$add_data(x = df, col_names = FALSE) ## write data.frame wb$add_conditional_formatting( sheet = \"colorScale\", dims = wb_dims( rows = seq_len(nrow(df)), cols = seq_len(ncol(df)) ), # dims = wb_dims(x = df, col_names = FALSE, select = \"data\") style = c(\"black\", \"white\"), rule = c(0, 255), type = \"colorScale\" ) wb$set_col_widths(\"colorScale\", cols = seq_along(df), widths = 1.07) wb$set_row_heights(\"colorScale\", rows = seq_len(nrow(df)), heights = 7.5)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"databars","dir":"Articles","previous_headings":"","what":"Databars","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"databar\") ## Databars wb$add_data(\"databar\", -5:5, start_col = 1) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = \"A1:A11\", type = \"dataBar\" ) ## Default colors wb$add_data(\"databar\", -5:5, start_col = 3) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = \"C1:C11\", type = \"dataBar\", params = list( showValue = FALSE, gradient = FALSE ) ) ## Default colors wb$add_data(\"databar\", -5:5, start_col = 5) wb <- wb_add_conditional_formatting( wb, sheet = \"databar\", dims = \"E1:E11\", type = \"dataBar\", style = c(\"#a6a6a6\"), params = list(showValue = FALSE) ) wb$add_data(\"databar\", -5:5, start_col = 7) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = \"G1:G11\", type = \"dataBar\", style = c(\"red\"), params = list( showValue = TRUE, gradient = FALSE ) ) # custom color wb$add_data(\"databar\", -5:5, start_col = 9) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = wb_dims(rows = 1:11, cols = 9), type = \"dataBar\", style = c(\"#a6a6a6\", \"#a6a6a6\"), params = list(showValue = TRUE, gradient = FALSE) ) # with rule wb$add_data(x = -5:5, start_col = 11) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = wb_dims(rows = 1:11, cols = 11), type = \"dataBar\", rule = c(0, 5), style = c(\"#a6a6a6\", \"#a6a6a6\"), params = list(showValue = TRUE, gradient = FALSE) )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"between","dir":"Articles","previous_headings":"","what":"Between","title":"Add conditional formatting to a workbook","text":"Highlight cells interval [-2, 2]","code":"wb$add_worksheet(\"between\") wb$add_data(\"between\", -5:5) wb$add_conditional_formatting( \"between\", dims = wb_dims(rows = 2:11, cols = 1), type = \"between\", rule = c(-2, 2) ) wb$add_worksheet(\"topN\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"top-n","dir":"Articles","previous_headings":"","what":"Top N","title":"Add conditional formatting to a workbook","text":"Highlight top 5 values column x Highlight top 20 percentage column y","code":"wb$add_data(\"topN\", data.frame(x = 1:10, y = rnorm(10))) wb$add_conditional_formatting( \"topN\", dims = wb_dims(rows = 2:11, cols = 1), style = \"posStyle\", type = \"topN\", params = list(rank = 5) ) wb$add_conditional_formatting( \"topN\", dims = wb_dims(rows = 2:11, cols = 2), style = \"posStyle\", type = \"topN\", params = list(rank = 20, percent = TRUE) ) wb$add_worksheet(\"bottomN\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"bottom-n","dir":"Articles","previous_headings":"","what":"Bottom N","title":"Add conditional formatting to a workbook","text":"Highlight bottom 5 values column x Highlight bottom 20 percentage column y","code":"wb$add_data(\"bottomN\", data.frame(x = 1:10, y = rnorm(10))) wb$add_conditional_formatting( \"bottomN\", dims = wb_dims(rows = 2:11, cols = 1), style = \"negStyle\", type = \"bottomN\", params = list(rank = 5) ) wb$add_conditional_formatting( \"bottomN\", cols = 2, rows = 2:11, style = \"negStyle\", type = \"bottomN\", params = list(rank = 20, percent = TRUE) ) wb$add_worksheet(\"logical operators\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"logical-operators","dir":"Articles","previous_headings":"","what":"Logical Operators","title":"Add conditional formatting to a workbook","text":"can use Excels logical Operators","code":"wb$add_data(\"logical operators\", 1:10) wb$add_conditional_formatting( \"logical operators\", dims = wb_dims(rows = 1:10, cols = 1), rule = \"OR($A1=1,$A1=3,$A1=5,$A1=7)\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"importing-data","dir":"Articles","previous_headings":"","what":"Importing data","title":"openxlsx2 basic manual","text":"Coming openxlsx might know read.xlsx() (two functions, one files one workbooks) readWorkbook(). Functions different things, mostly . openxlsx2 tried best reduce complexity hood user well. openxlsx2 replaced read_xlsx(), wb_read() share underlying function wb_to_df(). example use example data provided package. can locate “inst/extdata” folder. files included package source can open calculation software well.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"basic-import","dir":"Articles","previous_headings":"Importing data","what":"Basic import","title":"openxlsx2 basic manual","text":"begin openxlsx2_example.xlsx file telling R find file system object contains path xlsx file pass file function read workbook R output created data frame contains data types date, logical, numeric character. function import file R, wb_to_df() provides similar options openxlsx functions read.xlsx() readWorkbook() new functions go options. might noticed, return column xlsx file row name data frame returned. Per default first sheet workbook imported. want switch , either provide sheet parameter correct index provide sheet name.","code":"file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") # import workbook library(openxlsx2) wb_to_df(file) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"col_names---first-row-as-column-name","dir":"Articles","previous_headings":"Importing data","what":"col_names - first row as column name","title":"openxlsx2 basic manual","text":"previous example first imported row used column name data frame. default behavior, always wanted expected. Therefore behavior can disabled user.","code":"# do not convert first row to column names wb_to_df(file, col_names = FALSE) #> B C D E F G H I J #> 2 NA Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"detect_dates---convert-cells-to-r-dates","dir":"Articles","previous_headings":"Importing data","what":"detect_dates - convert cells to R dates","title":"openxlsx2 basic manual","text":"creators openxml standard well known mistakenly treating something date openxlsx2 built ways identify cell date try convert value , unfortunately always trivial task might fail. case provide option disable date conversion entirely. case underlying numerical value returned.","code":"# do not try to identify dates in the data wb_to_df(file, detect_dates = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 45075 3209324 This #DIV/0! 0.06059028 #> 4 TRUE NA NA #NUM! b 45069 0 0.58538194 #> 5 TRUE 2 NA 1.34 c 44958 #VALUE! 0.95905093 #> 6 FALSE 2 NA #NUM! NA 2 0.72561343 #> 7 FALSE 3 NA 1.56 e NA NA #> 8 FALSE 1 NA 1.7 f 44987 2.7 0.36525463 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23 h 45284 25 NA #> 11 FALSE 3 NA 67.3 i 45285 3 NA #> 12 NA 1 NA 123 45138 122 NA"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"show_formula---show-formulas-instead-of-results","dir":"Articles","previous_headings":"Importing data","what":"show_formula - show formulas instead of results","title":"openxlsx2 basic manual","text":"Sometimes things might feel . can openxml files updating formula results sheets unless opened software provides functionality certain tabular calculation software. Therefore user might interested underlying functions see going sheet. Using show_formula possible","code":"# return the underlying Excel formula instead of their values wb_to_df(file, show_formula = TRUE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This E3/0 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 C4 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! C6+E6 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 C8+E8 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 SUM(C10,E10) #> 11 FALSE 3 NA 67.3 i 2023-12-25 PRODUCT(C11,E3) #> 12 NA 1 NA 123 2023-07-31 E12-C12 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"dims---read-specific-dimension","dir":"Articles","previous_headings":"Importing data","what":"dims - read specific dimension","title":"openxlsx2 basic manual","text":"Sometimes entire worksheet contains much data, case provide functions read selected dimension range. range consists either specific cell like “A1” cell range notion used openxml standard Alternatively, don’t know Excel sheet’s address, can use wb_dims() specify dimension. See ?wb_dims details.","code":"# read dimension without column names wb_to_df(file, dims = \"A2:C5\", col_names = FALSE) #> A B C #> 2 NA NA Var2 #> 3 NA TRUE 1 #> 4 NA TRUE #> 5 NA TRUE 2 # read dimension without column names with `wb_dims()` wb_to_df(file, dims = wb_dims(rows = 2:5, cols = 1:3), col_names = FALSE) #> A B C #> 2 NA NA Var2 #> 3 NA TRUE 1 #> 4 NA TRUE #> 5 NA TRUE 2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"cols---read-selected-columns","dir":"Articles","previous_headings":"Importing data","what":"cols - read selected columns","title":"openxlsx2 basic manual","text":"want read specific cell, cell range can use column attribute. attribute takes numeric vector argument","code":"# read selected cols wb_to_df(file, cols = c(\"A:B\", \"G\")) #> NA Var1 Var5 #> 3 NA TRUE 2023-05-29 #> 4 NA TRUE 2023-05-23 #> 5 NA TRUE 2023-02-01 #> 6 NA FALSE #> 7 NA FALSE #> 8 NA FALSE 2023-03-02 #> 9 NA NA #> 10 NA FALSE 2023-12-24 #> 11 NA FALSE 2023-12-25 #> 12 NA NA 2023-07-31"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"rows---read-selected-rows","dir":"Articles","previous_headings":"Importing data","what":"rows - read selected rows","title":"openxlsx2 basic manual","text":"goes rows. can select using numeric vectors","code":"# read selected rows wb_to_df(file, rows = c(2, 4, 6)) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 4 TRUE NA NA #NUM! b 2023-05-23 NA 0 14:02:57 #> 6 FALSE 2 NA #NUM! NA 2 17:24:53"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"convert---convert-input-to-guessed-type","dir":"Articles","previous_headings":"Importing data","what":"convert - convert input to guessed type","title":"openxlsx2 basic manual","text":"xml exists difference value types. values per default characters. provide numerics, logicals dates, openxlsx2 every software dealing xlsx files make assumptions cell type. especially tricky due notion worksheets. Unlike data frame, worksheet can wild mix types data. Even though conversion process character date numeric rather solid, sometimes user might want see data without conversion applied. might useful cases something unexpected happened import created warnings. case can look raw input data. want disable date detection well, please see entry .","code":"# convert characters to numerics and date (logical too?) wb_to_df(file, convert = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 1 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"skip_empty_rows---remove-empty-rows","dir":"Articles","previous_headings":"Importing data","what":"skip_empty_rows - remove empty rows","title":"openxlsx2 basic manual","text":"Even though openxlsx2 imports everything requested, sometimes might helpful remove empty lines data. might either left empty intentional empty formatted, cell value removed afterwards. added mostly backward comparability, default changed FALSE. behavior changed bit well. Previously empty cells removed prior conversion R data frames, now removed conversion removed completely empty","code":"# erase empty rows from dataset wb_to_df(file, sheet = 1, skip_empty_rows = TRUE) |> tail() #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"skip_empty_cols---remove-empty-columns","dir":"Articles","previous_headings":"Importing data","what":"skip_empty_cols - remove empty columns","title":"openxlsx2 basic manual","text":"columns","code":"# erase empty cols from dataset wb_to_df(file, skip_empty_cols = TRUE) #> Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 NA 1 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"row_names---keep-rownames-from-input","dir":"Articles","previous_headings":"Importing data","what":"row_names - keep rownames from input","title":"openxlsx2 basic manual","text":"Sometimes data source might provide rownames well. case can openxlsx2 treat first column rowname","code":"# convert first row to rownames wb_to_df(file, sheet = 2, dims = \"C6:G9\", row_names = TRUE) #> mpg cyl disp hp #> Mazda RX4 21.0 6 160 110 #> Mazda RX4 Wag 21.0 6 160 110 #> Datsun 710 22.8 4 108 93"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"types---convert-column-to-specific-type","dir":"Articles","previous_headings":"Importing data","what":"types - convert column to specific type","title":"openxlsx2 basic manual","text":"user know better software type expect worksheet, can provided via types. parameter takes named numeric. 0 character, 1 numeric 2 date","code":"# define type of the data.frame wb_to_df(file, cols = c(2, 5), types = c(\"Var1\" = 0, \"Var3\" = 1)) #> Var1 Var3 #> 3 TRUE 1.00 #> 4 TRUE NaN #> 5 TRUE 1.34 #> 6 FALSE NA #> 7 FALSE 1.56 #> 8 FALSE 1.70 #> 9 NA #> 10 FALSE 23.00 #> 11 FALSE 67.30 #> 12 123.00"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"start_row---where-to-begin","dir":"Articles","previous_headings":"Importing data","what":"start_row - where to begin","title":"openxlsx2 basic manual","text":"Often creator worksheet used lot creativity data begin first row, instead begins somewhere else. define row begin reading, define via start_row parameter","code":"# start in row 5 wb_to_df(file, start_row = 5, col_names = FALSE) #> B C D E F G H I J #> 5 TRUE 2 NA 1.34 c 2023-02-01 NA #VALUE! 23:01:02 #> 6 FALSE 2 NA NA #NUM! NA 2 17:24:53 #> 7 FALSE 3 NA 1.56 e NA #> 8 FALSE 1 NA 1.70 f 2023-03-02 NA 2.7 08:45:58 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23.00 h 2023-12-24 NA 25 #> 11 FALSE 3 NA 67.30 i 2023-12-25 NA 3 #> 12 NA 1 NA 123.00 2023-07-31 NA 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"na-strings---define-missing-values","dir":"Articles","previous_headings":"Importing data","what":"na.strings - define missing values","title":"openxlsx2 basic manual","text":"“#N/” string, often user faced custom missing values values interested. strings can passed character vector via na.strings","code":"# na strings wb_to_df(file, na.strings = \"\") #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"importing-as-workbook","dir":"Articles","previous_headings":"Importing data","what":"Importing as workbook","title":"openxlsx2 basic manual","text":"addition importing directly xlsx xlsm files, openxlsx2 provides wbWorkbook class used importing modifying entire openxml files R. workbook class heart openxlsx2 probably reason reading manual first place. Importing file workbook looks like : additional options wb_load() provides internal use: sheet loads selected sheet workbook data_only reads data parts workbook ignores additional graphics pivot tables. functions create workbook objects can used read data, recommend end users use . Especially intend re-export workbook afterwards. workbook imported, provide several functions interact modify (wb_to_df() function mentioned works way imported workbook). possible add new sheets remove sheets, well add remove data. R-plots can inserted also style workbook can changed, new fonts, background colors number formats. wealth options explained man pages additional style vignette (vignettes follow).","code":"# the file we are going to load file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") # loading the file into the workbook wb <- wb_load(file = file)"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"exporting-data-frames-or-vectors","dir":"Articles","previous_headings":"Exporting data","what":"Exporting data frames or vectors","title":"openxlsx2 basic manual","text":"want export data frame R, can use write_xlsx() create xlsx file. file can tweaked . See ?write_xlsx see options. (explanation examples follow).","code":"write_xlsx(x = mtcars, file = \"mtcars.xlsx\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"exporting-a-wbworkbook","dir":"Articles","previous_headings":"Exporting data","what":"Exporting a wbWorkbook","title":"openxlsx2 basic manual","text":"Imported workbooks can saved xlsx xlsm files wrapper wb_save() wb$save(). functions take filename optional overwrite option. latter set, optional guard provided check file want write already exists. careful, optional. default save file replace existing file. course, Windows, files locked (example, opened another process) replaced.","code":"# replace the existing file wb$save(\"mtcars.xlsx\") # do not overwrite the existing file try(wb$save(\"mtcars.xlsx\", overwrite = FALSE))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"dims-wb_dims","dir":"Articles","previous_headings":"","what":"dims/ wb_dims()","title":"openxlsx2 basic manual","text":"openxlsx2 functions interact worksheet cells using dims argument require users provide . dims cells cell ranges A1 notation. single argument dims hereby replaces col/row, cols/rows xy. Since A1 notation rather simple first columns might get confusing 26. Therefore provide wrapper construct :","code":"# various options wb_dims(from_row = 4) #> [1] \"A4\" wb_dims(rows = 4, cols = 4) #> [1] \"D4\" wb_dims(rows = 4, cols = \"D\") #> [1] \"D4\" wb_dims(rows = 4:10, cols = 5:9) #> [1] \"E4:I10\" wb_dims(rows = 4:10, cols = \"A:D\") # same as below #> [1] \"A4:D10\" wb_dims(rows = seq_len(7), cols = seq_len(4), from_row = 4) #> [1] \"A4:D10\" # 10 rows and 15 columns from indice B2. wb_dims(rows = 1:10, cols = 1:15, from_col = \"B\", from_row = 2) #> [1] \"B2:P11\" # data + col names wb_dims(x = mtcars) #> [1] \"A1:K33\" # only data wb_dims(x = mtcars, select = \"data\") #> [1] \"A2:K33\" # The dims of the values of a column in `x` wb_dims(x = mtcars, cols = \"cyl\") #> [1] \"B2:B33\" # a column in `x` with the column name wb_dims(x = mtcars, cols = \"cyl\", select = \"x\") #> [1] \"B1:B33\" # rows in `x` wb_dims(x = mtcars) #> [1] \"A1:K33\" # in a wb chain wb <- wb_workbook()$ add_worksheet()$ add_data(x = mtcars)$ add_fill( dims = wb_dims(x = mtcars, rows = 1:5), # only 1st 5 rows of x data color = wb_color(\"yellow\") )$ add_fill( dims = wb_dims(x = mtcars, select = \"col_names\"), # only column names color = wb_color(\"cyan2\") ) # or if the data's first coord needs to be located in B2. wb_dims_custom <- function(...) { wb_dims(x = mtcars, from_col = \"B\", from_row = 2, ...) } wb <- wb_workbook()$ add_worksheet()$ add_data(x = mtcars, dims = wb_dims_custom())$ add_fill( dims = wb_dims_custom(rows = 1:5), color = wb_color(\"yellow\") )$ add_fill( dims = wb_dims_custom(select = \"col_names\"), color = wb_color(\"cyan2\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"a-note-on-speed-and-memory-usage","dir":"Articles","previous_headings":"","what":"A note on speed and memory usage","title":"openxlsx2 basic manual","text":"current state openxlsx2 reasonably fast. , works well reasonably large input data reading writing. may work well data tests limits openxml specification. Things may slow R side things, performance usability depend speed size local operating system’s CPU memory. Note least two cases openxlsx2 constructs potentially large data frames () loading, openxlsx2 usually needs read entire input file pugixml convert long data frame(s), wb_to_df() converts one long data frame two data frames construct output object (ii) adding data workbook, openxlsx2 reshapes input data frame long data frame stores workbook, writes entire worksheet pugixml file written complete. Applying cell styles, date conversions etc. slow process finally sheets zipped provide xlsx output. Therefore, faced unreasonably large dataset, either give enough time, use another package write xlsx output (openxlsx2 written intention working maximum memory efficiency), means use ways store data (binary file formats database). However, always happy improve, found way improve currently , please let us know open issue pull request.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"section","dir":"Articles","previous_headings":"","what":"Add charts to a workbook","title":"Add charts to a workbook","text":"","code":"library(openxlsx2) # openxlsx2 >= 0.4 for mschart and rvg support ## create a workbook wb <- wb_workbook()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-plot-to-workbook","dir":"Articles","previous_headings":"","what":"Add plot to workbook","title":"Add charts to a workbook","text":"can include image PNG JPEG format. Simply open device save output pass worksheet wb_add_image().","code":"myplot <- tempfile(fileext = \".jpg\") jpeg(myplot) print(plot(AirPassengers)) #> NULL dev.off() #> agg_png #> 2 # Add basic plots to the workbook wb$add_worksheet(\"add_image\")$add_image(file = myplot)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-ggplot2-plot-to-workbook","dir":"Articles","previous_headings":"","what":"Add {ggplot2} plot to workbook","title":"Add charts to a workbook","text":"can include ggplot2 plots similar include openxlsx. Call plot first afterwards use wb_add_plot().","code":"if (requireNamespace(\"ggplot2\")) { library(ggplot2) p <- ggplot(mtcars, aes(x = mpg, fill = as.factor(gear))) + ggtitle(\"Distribution of Gas Mileage\") + geom_density(alpha = 0.5) print(p) # Add ggplot to the workbook wb$add_worksheet(\"add_plot\")$ add_plot(width = 5, height = 3.5, file_type = \"png\", units = \"in\") } #> Loading required namespace: ggplot2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-plot-via-rvg","dir":"Articles","previous_headings":"","what":"Add plot via {rvg}","title":"Add charts to a workbook","text":"want vector graphics can modified spreadsheet software dml_xlsx() device comes handy. can pass output via wb_add_drawing().","code":"if (requireNamespace(\"ggplot2\") && requireNamespace(\"rvg\")) { library(rvg) ## create rvg example p <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Width)) + geom_point() + labs(title = \"With font Bradley Hand\") + theme_minimal(base_family = \"sans\", base_size = 18) tmp <- tempfile(fileext = \".xml\") rvg::dml_xlsx(file = tmp, fonts = list(sans = \"Bradley Hand\")) print(p) dev.off() # Add rvg to the workbook wb$add_worksheet(\"add_drawing\")$ add_drawing(xml = tmp)$ add_drawing(xml = tmp, dims = NULL) } #> Loading required namespace: rvg"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-mschart-plots","dir":"Articles","previous_headings":"","what":"Add {mschart} plots","title":"Add charts to a workbook","text":"want native open xml charts, look mschart. Create one chart files pass workbook wb_add_mschart(). two options possible. 1. Either default mschart output identical one officer. Passing data object let mschart prepare data. case wb_add_mschart() add new data region. 2. Passing wb_data() object mschart. object contains references data worksheet allows using data “”.","code":"if (requireNamespace(\"mschart\")) { library(mschart) # mschart >= 0.4 for openxlsx2 support ## create chart from mschart object (this creates new input data) mylc <- ms_linechart( data = browser_ts, x = \"date\", y = \"freq\", group = \"browser\" ) wb$add_worksheet(\"add_mschart\")$add_mschart(dims = \"A10:G25\", graph = mylc) ## create chart referencing worksheet cells as input # write data starting at B2 wb$add_worksheet(\"add_mschart - wb_data\")$ add_data(x = mtcars, dims = \"B2\")$ add_data(x = data.frame(name = rownames(mtcars)), dims = \"A2\") # create wb_data object this will tell this mschart # from this PR to create a file corresponding to openxlsx2 dat <- wb_data(wb, dims = \"A2:G10\") # create a few mscharts scatter_plot <- ms_scatterchart( data = dat, x = \"mpg\", y = c(\"disp\", \"hp\") ) bar_plot <- ms_barchart( data = dat, x = \"name\", y = c(\"disp\", \"hp\") ) area_plot <- ms_areachart( data = dat, x = \"name\", y = c(\"disp\", \"hp\") ) line_plot <- ms_linechart( data = dat, x = \"name\", y = c(\"disp\", \"hp\"), labels = c(\"disp\", \"hp\") ) # add the charts to the data wb <- wb %>% wb_add_mschart(dims = \"F4:L20\", graph = scatter_plot) %>% wb_add_mschart(dims = \"F21:L37\", graph = bar_plot) %>% wb_add_mschart(dims = \"M4:S20\", graph = area_plot) %>% wb_add_mschart(dims = \"M21:S37\", graph = line_plot) # add chartsheet wb <- wb %>% wb_add_chartsheet() %>% wb_add_mschart(graph = scatter_plot) } #> Loading required namespace: mschart"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"simple-formulas","dir":"Articles","previous_headings":"","what":"Simple formulas","title":"Add formulas to a workbook","text":"","code":"wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"SUM(A2, B2)\", dims = \"D2\")$ add_formula(x = \"A2 + B2\", dims = \"D3\") # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"array-formulas","dir":"Articles","previous_headings":"","what":"Array formulas","title":"Add formulas to a workbook","text":"","code":"wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"A2:A7 * B2:B7\", dims = \"C2:C7\", array = TRUE) # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"array-formulas-creating-multiple-fields","dir":"Articles","previous_headings":"","what":"Array formulas creating multiple fields","title":"Add formulas to a workbook","text":"example want use MMULT() creates matrix multiplication. requires us write array formula specify region output written . Similar coefficients linear regression","code":"m1 <- matrix(1:6, ncol = 2) m2 <- matrix(7:12, nrow = 2) wb <- wb_workbook()$add_worksheet()$ add_data(x = m1)$ add_data(x = m2, dims = wb_dims(from_col = 4))$ add_formula(x = \"MMULT(A2:B4, D2:F3)\", dims = \"H2:J4\", array = TRUE) # wb$open() # we expect to find this in D1:E1 coef(lm(head(cars))) #> (Intercept) dist #> 5.2692308 0.1153846 wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"LINEST(A2:A7, B2:B7, TRUE)\", dims = \"D2:E2\", array = TRUE) # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"cells-metadata-cm-formulas","dir":"Articles","previous_headings":"","what":"cells metadata (cm) formulas","title":"Add formulas to a workbook","text":"Similar array formulas, cell metadata (cm) formulas hide user array formulas. Using implemented openxlsx2 > 0.6.1:","code":"wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"SUM(ABS(A2:A7))\", dims = \"D2\", cm = TRUE) #> Warning in write_data2(wb = wb, sheet = sheet, data = x, name = name, colNames #> = colNames, : modifications with cm formulas are experimental. use at own risk # wb$open()"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"datatable-formula-differences","dir":"Articles","previous_headings":"dataTable formulas1","what":"dataTable formula differences","title":"Add formulas to a workbook","text":"Given basic table like , similarly basic formula total_sales “= A2 * C2” row value changing row. implementation formula using wb_add_formula() look (taken current documentation) lets say ’ve read data assigned table company_sales create workbook, worksheet, use wb_add_data_table(). One advantages open xml dataTable syntax don’t specify row numbers columns letters. table also grows dynamically, adding new rows new data appended extending formulas new rows. dataTable named columns can use instead letters. writing formulas within dataTable use following syntax [@[column_name]] reference current row. “total_sales” formula written open xml dataTable look like ; =[@[sales_price]] * [@[sales_quantity]] writing formula outside dataTable reference table name. case lets say table name ‘daily_sales’ =daily_sales[@[sales_price]] * daily_sales[@[sales_quantity]] However, pass text formula written cause error syntax open xml requires selecting current row different. open xml dataTable formula looks like : Now can see open xml replaces [@[sales_price]] daily_sales[[#Row],[sales_price]] must use syntax writing formulas dataTable open workbook view table created can see formula worked. can also see replaced [#Row] @. completion, formula wrote appears ;","code":"## creating example data company_sales <- data.frame( sales_price = c(20, 30, 40), COGS = c(5, 11, 13), sales_quantity = c(1, 2, 3) ) ## write in the formula company_sales$total_sales <- paste(paste0(\"A\", 1:3 + 1L), paste0(\"C\", 1:3 + 1L), sep = \" * \") ## add the formula class class(company_sales$total_sales) <- c(class(company_sales$total_sales), \"formula\") ## write a workbook wb <- wb_workbook()$ add_worksheet(\"Total Sales\")$ add_data_table(x = company_sales) daily_sales[[#This Row],[sales_price]]*daily_sales[[#ThisRow],[sales_quantity]] <\/calculatedColumnFormula> ## Because we want the `dataTable` formula to propagate down the entire column of the data ## we can assign the formula by itself to any column and allow that single string to be repeated for each row. ## creating example data example_data <- data.frame( sales_price = c(20, 30, 40), COGS = c(5, 11, 13), sales_quantity = c(1, 2, 3) ) ## base R method example_data$gross_profit <- \"daily_sales[[#This Row],[sales_price]] - daily_sales[[#This Row],[COGS]]\" example_data$total_COGS <- \"daily_sales[[#This Row],[COGS]] * daily_sales[[#This Row],[sales_quantity]]\" example_data$total_sales <- \"daily_sales[[#This Row],[sales_price]] * daily_sales[[#This Row],[sales_quantity]]\" example_data$total_gross_profit <- \"daily_sales[[#This Row],[total_sales]] - daily_sales[[#This Row],[total_COGS]]\" class(example_data$gross_profit) <- c(class(example_data$gross_profit), \"formula\") class(example_data$total_COGS) <- c(class(example_data$total_COGS), \"formula\") class(example_data$total_sales) <- c(class(example_data$total_sales), \"formula\") class(example_data$total_gross_profit) <- c(class(example_data$total_gross_profit), \"formula\") wb$ add_worksheet(\"Daily Sales\")$ add_data_table( x = example_data, table_style = \"TableStyleMedium2\", table_name = \"daily_sales\" ) #### sum dataTable examples wb$add_worksheet(\"sum_examples\") ### Note: dataTable formula do not need to be used inside of dataTables. dataTable formula are for referencing the data within the dataTable. ### Note: dataTable formula do not need to be used inside of dataTables. dataTable formula are for referencing the data within the dataTable. sum_examples <- data.frame( description = c(\"sum_sales_price\", \"sum_product_Price_Quantity\"), formula = c(\"\", \"\") ) wb$add_data(x = sum_examples) # add formulas wb$add_formula(x = \"sum(daily_sales[[#Data],[sales_price]])\", dims = \"B2\") wb$add_formula(x = \"sum(daily_sales[[#Data],[sales_price]] * daily_sales[[#Data],[sales_quantity]])\", dims = \"B3\", array = TRUE) #### dataTable referencing wb$add_worksheet(\"dt_references\") ### Adding the headers by themselves. wb$add_formula( x = \"daily_sales[[#Headers],[sales_price]:[total_gross_profit]]\", dims = \"A1:G1\", array = TRUE ) ### Adding the raw data by reference and selecting them directly. wb$add_formula( x = \"daily_sales[[#Data],[sales_price]:[total_gross_profit]]\", start_row = 2, dims = \"A2:G4\", array = TRUE ) # wb$open()"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"colors-text-rotation-and-number-formats","dir":"Articles","previous_headings":"Styling showcase","what":"Colors, text rotation and number formats","title":"Add styling to a workbook","text":"show two ways create styled tables openxlsx2 one using high level functions style worksheet areas one using bare metal approach creating identical table. show ways create styles openxlsx2 show build functions create functions. example , increased column width.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-quick-way-using-high-level-functions","dir":"Articles","previous_headings":"Styling showcase > Colors, text rotation and number formats","what":"the quick way: using high level functions","title":"Add styling to a workbook","text":"","code":"# add some dummy data set.seed(123) mat <- matrix(rnorm(28 * 28, mean = 44444, sd = 555), ncol = 28) colnames(mat) <- make.names(seq_len(ncol(mat))) border_col <- wb_color(theme = 1) border_sty <- \"thin\" # using ) to avoid counting manually which `dims` are spanned. dims_mat_header <- wb_dims(rows = 1, cols = seq_len(ncol(mat))) # returns \"A1:AB1\" # prepare workbook with data and formated first row wb <- wb_workbook() %>% wb_add_worksheet(\"test\") %>% wb_add_data(x = mat) %>% wb_add_border(dims = dims_mat_header, top_color = border_col, top_border = border_sty, bottom_color = border_col, bottom_border = border_sty, left_color = border_col, left_border = border_sty, right_color = border_col, right_border = border_sty, inner_hcolor = border_col, inner_hgrid = border_sty ) %>% wb_add_fill(dims = dims_mat_header, color = wb_color(hex = \"FF334E6F\")) %>% wb_add_font(dims = dims_mat_header, name = \"Arial\", bold = TRUE, color = wb_color(\"white\"), size = 20) %>% wb_add_cell_style(dims = dims_mat_header, horizontal = \"center\", textRotation = 45) # create various number formats x <- c( 0, 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 37, 38, 39, 40, 45, 46, 47, 48, 49 ) # apply the styles for (i in seq_along(x)) { cell <- sprintf(\"%s2:%s29\", int2col(i), int2col(i)) wb <- wb %>% wb_add_numfmt(dims = cell, numfmt = x[i]) } # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-long-way-using-bare-metal-functions","dir":"Articles","previous_headings":"Styling showcase > Colors, text rotation and number formats","what":"the long way: using bare metal functions","title":"Add styling to a workbook","text":"","code":"# create workbook wb <- wb_workbook() %>% wb_add_worksheet(\"test\") # add some dummy data to the worksheet set.seed(123) mat <- matrix(rnorm(28 * 28, mean = 44444, sd = 555), ncol = 28) colnames(mat) <- make.names(seq_len(ncol(mat))) wb$add_data(x = mat, col_names = TRUE) # create a border style and assign it to the workbook black <- wb_color(\"black\") # same as wb_color(\"black\") or wb_color(hex = \"FF000000\") or wb_color(\"FF000000\") new_border <- create_border( bottom = \"thin\", bottom_color = black, top = \"thin\", top_color = black, left = \"thin\", left_color = black, right = \"thin\", right_color = black ) wb$styles_mgr$add(new_border, \"new_border\") # create a fill style and assign it to the workbook new_fill <- create_fill(patternType = \"solid\", fgColor = wb_color(hex = \"FF334E6F\")) wb$styles_mgr$add(new_fill, \"new_fill\") # create a font style and assign it to the workbook new_font <- create_font(sz = 20, name = \"Arial\", b = TRUE, color = wb_color(\"white\")) wb$styles_mgr$add(new_font, \"new_font\") # create a new cell style, that uses the fill, the font and the border style new_cellxfs <- create_cell_style( num_fmt_id = 0, horizontal = \"center\", text_rotation = 45, fill_id = wb$styles_mgr$get_fill_id(\"new_fill\"), font_id = wb$styles_mgr$get_font_id(\"new_font\"), border_id = wb$styles_mgr$get_border_id(\"new_border\") ) # assign this style to the workbook wb$styles_mgr$add(new_cellxfs, \"new_styles\") # assign the new cell style to the header row of our data set # Achieve the same with `wb_dims()` and sprintf # cell <- sprintf(\"A1:%s1\", int2col(nrow(mat))) cell <- wb_dims(rows = 1, cols = seq_len(ncol(mat))) wb <- wb %>% wb_set_cell_style( dims = cell, style = wb$styles_mgr$get_xf_id(\"new_styles\") ) ## style the cells with some builtin format codes (no new numFmt entry is needed) # add builtin style ids x <- c( 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 37, 38, 39, 40, 45, 46, 47, 48, 49 ) # create styles new_cellxfs <- create_cell_style(num_fmt_id = x, horizontal = \"center\") # assign the styles to the workbook for (i in seq_along(x)) { wb$styles_mgr$add(new_cellxfs[i], paste0(\"new_style\", i)) } # new styles are 1:28 new_styles <- wb$styles_mgr$get_xf() for (i in as.integer(new_styles$id[new_styles$name %in% paste0(\"new_style\", seq_along(x))])) { cell <- wb_dims(rows = seq_len(nrow(mat)), cols = i, from_row = 2) wb <- wb %>% wb_set_cell_style(dims = cell, style = i) } # assign a custom tabColor wb$worksheets[[1]]$sheetPr <- xml_node_create( \"sheetPr\", xml_children = xml_node_create( \"tabColor\", xml_attributes = wb_color(hex = \"FF00FF00\") ) ) # # look at the beauty you've created # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"working-with-number-formats","dir":"Articles","previous_headings":"","what":"Working with number formats","title":"Add styling to a workbook","text":"default, openxlsx2 pick number formats selected R classes.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"numfmts","dir":"Articles","previous_headings":"Working with number formats","what":"numfmts","title":"Add styling to a workbook","text":"","code":"## Create Workbook object and add worksheets wb <- wb_workbook() wb$add_worksheet(\"S1\") wb$add_worksheet(\"S2\") df <- data.frame( \"Date\" = Sys.Date() - 0:19, \"T\" = TRUE, \"F\" = FALSE, \"Time\" = Sys.time() - 0:19 * 60 * 60, \"Cash\" = paste(\"$\", 1:20), \"Cash2\" = 31:50, \"hLink\" = \"https://CRAN.R-project.org/\", \"Percentage\" = seq(0, 1, length.out = 20), \"TinyNumbers\" = runif(20) / 1E9, stringsAsFactors = FALSE ) ## openxlsx will apply default Excel styling for these classes class(df$Cash) <- c(class(df$Cash), \"currency\") class(df$Cash2) <- c(class(df$Cash2), \"accounting\") class(df$hLink) <- \"hyperlink\" class(df$Percentage) <- c(class(df$Percentage), \"percentage\") class(df$TinyNumbers) <- c(class(df$TinyNumbers), \"scientific\") wb$add_data(\"S1\", x = df, start_row = 4, row_names = FALSE) wb$add_data_table(\"S2\", x = df, start_row = 4, row_names = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"numfmts2","dir":"Articles","previous_headings":"Working with number formats","what":"numfmts2","title":"Add styling to a workbook","text":"addition, can set style picked using openxlsx2 options.","code":"wb <- wb_workbook() wb <- wb_add_worksheet(wb, \"test\") options(\"openxlsx2.dateFormat\" = \"yyyy\") options(\"openxlsx2.datetimeFormat\" = \"yyyy-mm-dd\") options(\"openxlsx2.numFmt\" = \"€ #.0\") df <- data.frame( \"Date\" = Sys.Date() - 0:19, \"T\" = TRUE, \"F\" = FALSE, \"Time\" = Sys.time() - 0:19 * 60 * 60, \"Cash\" = paste(\"$\", 1:20), \"Cash2\" = 31:50, \"hLink\" = \"https://CRAN.R-project.org/\", \"Percentage\" = seq(0, 1, length.out = 20), \"TinyNumbers\" = runif(20) / 1E9, stringsAsFactors = FALSE, \"numeric\" = 1 ) ## openxlsx will apply default Excel styling for these classes class(df$Cash) <- c(class(df$Cash), \"currency\") class(df$Cash2) <- c(class(df$Cash2), \"accounting\") class(df$hLink) <- \"hyperlink\" class(df$Percentage) <- c(class(df$Percentage), \"percentage\") class(df$TinyNumbers) <- c(class(df$TinyNumbers), \"scientific\") wb$add_data(\"test\", df)"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"wb_set_col_widths","dir":"Articles","previous_headings":"Modifying the column widths","what":"wb_set_col_widths","title":"Add styling to a workbook","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars, row_names = TRUE) cols <- 1:12 wb <- wb %>% wb_set_col_widths(cols = cols, widths = \"auto\")"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"add-borders","dir":"Articles","previous_headings":"Adding borders","what":"add borders","title":"Add styling to a workbook","text":"","code":"wb <- wb_workbook() # full inner grid wb$add_worksheet(sheet = \"S1\", grid_lines = FALSE)$ add_data(x = mtcars) wb$add_border( dims = \"A2:K33\", # can use wb_dims(rows = 2:33, cols = ncol(mtcars)) inner_hgrid = \"thin\", inner_hcolor = wb_color(hex = \"FF808080\"), inner_vgrid = \"thin\", inner_vcolor = wb_color(hex = \"FF808080\") ) # only horizontal grid wb$add_worksheet(\"S2\", grid_lines = FALSE)$ add_data(x = mtcars) wb$add_border( dims = \"A2:K33\", inner_hgrid = \"thin\", inner_hcolor = wb_color(hex = \"FF808080\") ) # only vertical grid wb$add_worksheet(\"S3\", grid_lines = FALSE)$ add_data(x = mtcars) wb$add_border( dims = \"A2:K33\", inner_vgrid = \"thin\", inner_vcolor = wb_color(hex = \"FF808080\") ) # no inner grid wb$add_worksheet(\"S4\", grid_lines = FALSE)$add_data(x = mtcars) wb$add_border(\"S4\", dims = \"A2:K33\") # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"styled-table","dir":"Articles","previous_headings":"Adding borders","what":"styled table","title":"Add styling to a workbook","text":"show two ways create styled tables openxlsx2 one using high level functions style worksheet areas one using bare metal approach creating identical table.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-quick-way-using-high-level-functions-1","dir":"Articles","previous_headings":"Adding borders > styled table","what":"the quick way: using high level functions","title":"Add styling to a workbook","text":"","code":"# add some dummy data to the worksheet mat <- matrix(1:4, ncol = 2, nrow = 2) colnames(mat) <- make.names(seq_len(ncol(mat))) wb <- wb_workbook() %>% wb_add_worksheet(\"test\") %>% wb_add_data(x = mat, dims = wb_dims(from_row = 2, from_col = 2)) %>% # center first row wb_add_cell_style(dims = \"B2:C2\", horizontal = \"center\") %>% # add border for first row wb_add_border( dims = \"B2:C2\", bottom_color = wb_color(theme = 1), bottom_border = \"thin\", top_color = wb_color(theme = 1), top_border = \"double\", left_border = NULL, right_border = NULL ) %>% # add border for last row wb_add_border( dims = \"B4:C4\", bottom_color = wb_color(theme = 1), bottom_border = \"double\", top_border = NULL, left_border = NULL, right_border = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-long-way-creating-everything-from-the-bone","dir":"Articles","previous_headings":"Adding borders > styled table","what":"the long way: creating everything from the bone","title":"Add styling to a workbook","text":"","code":"# add some dummy data to the worksheet mat <- matrix(1:4, ncol = 2, nrow = 2) colnames(mat) <- make.names(seq_len(ncol(mat))) wb <- wb_workbook() %>% wb_add_worksheet(\"test\") %>% wb_add_data( x = mat, dims = wb_dims(2, 2) ) # create a border style and assign it to the workbook black <- wb_color(\"black\") top_border <- create_border( top = \"double\", top_color = black, bottom = \"thin\", bottom_color = black ) bottom_border <- create_border(bottom = \"double\", bottom_color = black) wb$styles_mgr$add(top_border, \"top_border\") wb$styles_mgr$add(bottom_border, \"bottom_border\") # create a new cell style, that uses the fill, the font and the border style top_cellxfs <- create_cell_style( num_fmt_id = 0, horizontal = \"center\", border_id = wb$styles_mgr$get_border_id(\"top_border\") ) bottom_cellxfs <- create_cell_style( num_fmt_id = 0, border_id = wb$styles_mgr$get_border_id(\"bottom_border\") ) # assign this style to the workbook wb$styles_mgr$add(top_cellxfs, style_name = \"top_styles\") wb$styles_mgr$add(bottom_cellxfs, \"bottom_styles\") # assign the new cell style to the header row of our data set cell <- \"B2:C2\" wb <- wb %>% wb_set_cell_style(dims = cell, style = wb$styles_mgr$get_xf_id(\"top_styles\")) cell <- \"B4:C4\" wb <- wb %>% wb_set_cell_style(dims = cell, style = wb$styles_mgr$get_xf_id(\"bottom_styles\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"use-workbook-colors-and-modify-them","dir":"Articles","previous_headings":"","what":"Use workbook colors and modify them","title":"Add styling to a workbook","text":"loop apply tint attribute fill color Tint variations theme colors.","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") tints <- seq(-0.9, 0.9, by = 0.1) for (i in 0:9) { for (tnt in tints) { col <- paste0(int2col(i + 1), which(tints %in% tnt)) if (tnt == 0) { wb <- wb %>% wb_add_fill(dims = col, color = wb_color(theme = i)) } else { wb <- wb %>% wb_add_fill(dims = col, color = wb_color(theme = i, tint = tnt)) } } }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"copy-cell-styles","dir":"Articles","previous_headings":"","what":"Copy cell styles","title":"Add styling to a workbook","text":"possible copy styles several cells . following example, styles cells formatted workbook applied previously empty cell range. careful though, wb_get_cell_style() returns styles, make sure copy-copy-dimensions match meaningful way.","code":"wb <- wb_load(system.file(\"extdata\", \"oxlsx2_sheet.xlsx\", package = \"openxlsx2\")) %>% wb_set_cell_style(1, \"A30:G35\", wb_get_cell_style(., 1, \"A10:G15\")) # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"style-strings","dir":"Articles","previous_headings":"","what":"Style strings","title":"Add styling to a workbook","text":"Using fmt_txt() possible style strings independently cell containing string. shown possible combine multiple styles together longer string. even possible use fmt_txt() na.strings:","code":"txt <- paste( fmt_txt(\"Embracing the full potential of \"), fmt_txt(\"openxlsx2\", bold = TRUE, size = 16), fmt_txt(\" with \"), fmt_txt(\"fmt_txt()\", font = \"Courier\"), fmt_txt(\" !\") ) wb <- wb_workbook()$add_worksheet()$add_data(x = txt) df <- mtcars df[df < 4] <- NA na_red <- fmt_txt(\"N/A\", color = wb_color(\"red\"), italic = TRUE, bold = TRUE) wb <- wb_workbook()$add_worksheet()$add_data(x = df, na.strings = na_red)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"create-custom-table-styles","dir":"Articles","previous_headings":"","what":"Create custom table styles","title":"Add styling to a workbook","text":"create_tablestyle() possible create table styles. function uses create_dxfs_style() (just like spreadsheet software ). Therefore, quite user-friendly. following example shows function creates red table style. various dxfs styles must created assigned workbook (similar styles used conditional formatting). create_tablestyle() styles assigned table style elements. table style created, must also assigned workbook. can use workbook like table style.","code":"# a red table style dx0 <- create_dxfs_style( border = TRUE, left_color = wb_color(\"red\"), right_color = NULL, right_style = NULL, top_color = NULL, top_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx1 <- create_dxfs_style( border = TRUE, left_color = wb_color(\"red\"), right_color = NULL, right_style = NULL, top_color = NULL, top_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx2 <- create_dxfs_style( border = TRUE, top_color = wb_color(\"red\"), left_color = NULL, left_style = NULL, right_color = NULL, right_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx3 <- create_dxfs_style( border = TRUE, top_color = wb_color(\"red\"), left_color = NULL, left_style = NULL, right_color = NULL, right_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx4 <- create_dxfs_style( text_bold = TRUE ) dx5 <- create_dxfs_style( text_bold = TRUE ) dx6 <- create_dxfs_style( font_color = wb_color(\"red\"), text_bold = TRUE, border = TRUE, top_style = \"double\", left_color = NULL, left_style = NULL, right_color = NULL, right_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx7 <- create_dxfs_style( font_color = wb_color(\"white\"), text_bold = TRUE, bgFill = wb_color(\"red\"), fgColor = wb_color(\"red\") ) dx8 <- create_dxfs_style( border = TRUE, left_color = wb_color(\"red\"), top_color = wb_color(\"red\"), right_color = wb_color(\"red\"), bottom_color = wb_color(\"red\") ) wb <- wb_workbook() %>% wb_add_worksheet(grid_lines = FALSE) wb$add_style(dx0) wb$add_style(dx1) wb$add_style(dx2) wb$add_style(dx3) wb$add_style(dx4) wb$add_style(dx5) wb$add_style(dx6) wb$add_style(dx7) wb$add_style(dx8) # finally create the table xml <- create_tablestyle( name = \"red_table\", whole_table = wb$styles_mgr$get_dxf_id(\"dx8\"), header_row = wb$styles_mgr$get_dxf_id(\"dx7\"), total_row = wb$styles_mgr$get_dxf_id(\"dx6\"), first_column = wb$styles_mgr$get_dxf_id(\"dx5\"), last_column = wb$styles_mgr$get_dxf_id(\"dx4\"), first_row_stripe = wb$styles_mgr$get_dxf_id(\"dx3\"), second_row_stripe = wb$styles_mgr$get_dxf_id(\"dx2\"), first_column_stripe = wb$styles_mgr$get_dxf_id(\"dx1\"), second_column_stripe = wb$styles_mgr$get_dxf_id(\"dx0\") ) wb$add_style(xml) # create a table and apply the custom style wb <- wb %>% wb_add_data_table(x = mtcars, table_style = \"red_table\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jordan Mark Barbone. Author. Jan Marvin Garbuszus. Author, maintainer. Oliver Roy. Contributor. openxlsx authors. Copyright holder. openxlsx package Arseny Kapoulkine. Contributor, copyright holder. Author included pugixml code","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"(2023). openxlsx2: Read, Write Edit 'xlsx' Files. R package version 1.1.0.9000. URL https://github.com/JanMarvin/openxlsx2.","code":"@Manual{, title = {openxlsx2: Read, Write and Edit 'xlsx' Files}, year = {2023}, note = {R package version 1.1.0.9000}, url = {https://janmarvin.github.io/openxlsx2/}, }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"openxlsx2","dir":"","previous_headings":"","what":"Read, Write and Edit xlsx Files","title":"Read, Write and Edit xlsx Files","text":"R package modern reinterpretation widely used popular openxlsx package. Similar predecessor, simplifies creation xlsx files providing clean interface writing, designing editing worksheets. Based powerful XML library focusing modern programming flows pipes chains, openxlsx2 allows break many new ground.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Read, Write and Edit xlsx Files","text":"can install stable version openxlsx2 : can install development version openxlsx2 GitHub : r-universe :","code":"install.packages('openxlsx2') # install.packages(\"remotes\") remotes::install_github(\"JanMarvin/openxlsx2\") # Enable repository from janmarvin options(repos = c( janmarvin = 'https://janmarvin.r-universe.dev', CRAN = 'https://cloud.r-project.org')) # Download and install openxlsx2 in R install.packages('openxlsx2')"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"introduction","dir":"","previous_headings":"","what":"Introduction","title":"Read, Write and Edit xlsx Files","text":"openxlsx2 aims swiss knife working openxml spreadsheet formats xlsx, xlsm (limited) xlsb (formats spreadsheet software supported). offer two different variants work openxlsx2. first one simply work R objects. possible read (read_xlsx()) write (write_xlsx()) data files. offer number options commands support various features openxml format, including reading writing named ranges tables. Furthermore, several ways read certain information openxml spreadsheet without opened spreadsheet software , e.g. get contained sheet names tables. second variant openxlsx2 offers work called wbWorkbook objects. openxml file read corresponding wbWorkbook object (wb_load()) new one created (wb_workbook()). Afterwards object can modified using various functions. example, worksheets can added removed, layout cells entire worksheets can changed, cells can modified (overwritten rewritten). Afterwards wbWorkbook objects can written openxml files processed suitable spreadsheet software. Many examples work openxlsx2 manual pages vignettes. can find :","code":"vignette(package = \"openxlsx2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Read, Write and Edit xlsx Files","text":"basic example shows solve common problem:","code":"library(openxlsx2) # read xlsx or xlsm files path <- system.file(\"extdata/openxlsx2_example.xlsx\", package = \"openxlsx2\") read_xlsx(path) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # or import workbooks wb <- wb_load(path) wb #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet1, Sheet2 #> Write order: 1, 2 # read a data frame wb_to_df(wb) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # and save temp <- temp_xlsx() if (interactive()) wb_save(wb, temp) ## or create one yourself wb <- wb_workbook() # add a worksheet wb$add_worksheet(\"sheet\") # add some data wb$add_data(\"sheet\", cars) # open it in your default spreadsheet software if (interactive()) wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"authors-and-contributions","dir":"","previous_headings":"","what":"Authors and contributions","title":"Read, Write and Edit xlsx Files","text":"full list authors made package possible greatful, please see: feel like included list, please let us know. something contribute, welcome. something working expected, open issues solved issue, open pull request. Please respectful aware volunteers fun unpaid free time. work problems time need.","code":"system.file(\"AUTHORS\", package = \"openxlsx2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Read, Write and Edit xlsx Files","text":"package licensed MIT license based openxlsx (Alexander Walker Philipp Schauberger; COPYRIGHT 2014-2022) pugixml (Arseny Kapoulkine; COPYRIGHT 2006-2023). released MIT license.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"Get set table sheets state selected active workbook Multiple sheets can selected, single one can active (visible). visible sheet, must necessarily selected sheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"","code":"wb_get_active_sheet(wb) wb_set_active_sheet(wb, sheet) wb_get_selected(wb) wb_set_selected(wb, sheet)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"wb workbook sheet sheet name workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"data frame tabSelected names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"","code":"wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) # testing is the selected sheet wb_get_selected(wb) #> tabSelected topLeftCell workbookViewId names #> 1 1 0 Sheet1 #> 2 A3 0 Sheet2 # change the selected sheet to Sheet2 wb <- wb_set_selected(wb, \"Sheet2\") # get the active sheet wb_get_active_sheet(wb) #> numeric(0) # change the selected sheet to Sheet2 wb <- wb_set_active_sheet(wb, sheet = \"Sheet2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"loads character string to pugixml and returns an externalptr — as_xml","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"loads character string pugixml returns externalptr","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"","code":"as_xml(x, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"x input xml ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"might useful larger documents single nodes shortened otherwise full tree reimported. unsure case. useful, printing nodes larger tree, exported characters (point time convert xml R)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"","code":"tmp_xlsx <- tempfile() xlsxFile <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") unzip(xlsxFile, exdir = tmp_xlsx) wb <- wb_load(xlsxFile) styles_xml <- sprintf(\"%s/xl/styles.xml\", tmp_xlsx) # is external pointer sxml <- read_xml(styles_xml) # is character font <- xml_node(sxml, \"styleSheet\", \"fonts\", \"font\") # is again external pointer as_xml(font) #> #> #> #> #> #> #> <\/font> #> #> #> #> #> #> <\/font> #> #> #> #> #> #> <\/font>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the default font in a workbook — base_font-wb","title":"Set the default font in a workbook — base_font-wb","text":"Modify / get default font workbook. base font workbook affect font data tables.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the default font in a workbook — base_font-wb","text":"","code":"wb_set_base_font( wb, font_size = 11, font_color = wb_color(theme = \"1\"), font_name = \"Calibri\", ... ) wb_get_base_font(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the default font in a workbook — base_font-wb","text":"wb workbook object font_size Font size font_color Font color font_name Name font ... Additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set the default font in a workbook — base_font-wb","text":"font name validated anyway. Excel replaces unknown font names Arial. default base font Calibri, black, size 11.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set the default font in a workbook — base_font-wb","text":"","code":"## create a workbook wb <- wb_workbook() wb$add_worksheet(\"S1\") ## modify base font to size 10 Arial Narrow in red wb$set_base_font(font_size = 10, font_color = wb_color(\"red\"), font_name = \"Arial Narrow\") wb$add_data(x = iris) ## font color does not affect tables wb$add_data_table(x = iris, dims = wb_dims(from_col = 10)) ## get the base font wb_get_base_font(wb) #> $size #> $size$val #> [1] \"10\" #> #> #> $color #> $color$rgb #> [1] \"FFFF0000\" #> #> #> $name #> $name$val #> [1] \"Arial Narrow\" #> #>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Clean worksheet name — clean_worksheet_name","title":"Clean worksheet name — clean_worksheet_name","text":"Cleans worksheet name removing legal characters.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Clean worksheet name — clean_worksheet_name","text":"","code":"clean_worksheet_name(x, replacement = \" \")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Clean worksheet name — clean_worksheet_name","text":"x vector, coerced character replacement single value replace illegal characters .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Clean worksheet name — clean_worksheet_name","text":"x bad characters removed","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Clean worksheet name — clean_worksheet_name","text":"Illegal characters considered \\, /, ?, *, :, [, ]. must intentionally removed worksheet names prior creating new worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Excel column to integer — col2int","title":"Convert Excel column to integer — col2int","text":"Converts Excel column label integer.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Excel column to integer — col2int","text":"","code":"col2int(x)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Excel column to integer — col2int","text":"x character vector","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Excel column to integer — col2int","text":"integer column label (NULL x NULL)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert Excel column to integer — col2int","text":"","code":"col2int(LETTERS) #> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #> [26] 26"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column widths of a worksheet — col_widths-wb","title":"Modify column widths of a worksheet — col_widths-wb","text":"Remove / set worksheet column widths specified width \"auto\".","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column widths of a worksheet — col_widths-wb","text":"","code":"wb_set_col_widths( wb, sheet = current_sheet(), cols, widths = 8.43, hidden = FALSE ) wb_remove_col_widths(wb, sheet = current_sheet(), cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column widths of a worksheet — col_widths-wb","text":"wb wbWorkbook object. sheet name index worksheet, vector case remove_ cols Indices cols set/remove column widths. widths Width set cols specified column width \"auto\" automatic sizing. widths recycled length cols. openxlsx2 sets default width 8.43, standard spreadsheet software. See Details general information column widths. hidden Logical vector recycled length cols. TRUE, columns hidden.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify column widths of a worksheet — col_widths-wb","text":"global min max column width \"auto\" columns set (default values show): options(\"openxlsx2.minWidth\" = 3) options(\"openxlsx2.maxWidth\" = 250) Maximum width allowed Excel NOTE: calculation column widths can slow large worksheets. NOTE: hidden parameter may conflict one set wb_group_cols(); changing one update . NOTE: default column width varies spreadsheet software, operating system, DPI settings used. Setting widths specific value also guarantee output consistent column widths.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column widths of a worksheet — col_widths-wb","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\") ## set col widths wb$set_col_widths(cols = c(1, 4, 6, 7, 9), widths = c(16, 15, 12, 18, 33)) ## auto columns wb$add_worksheet(\"Sheet 2\") wb$add_data(sheet = 2, x = iris) wb$set_col_widths(sheet = 2, cols = 1:5, widths = \"auto\") ## removing column widths ## Create a new workbook wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) ## remove column widths in columns 1 to 20 wb_remove_col_widths(wb, 1, cols = 1:20)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":null,"dir":"Reference","previous_headings":"","what":"Internal comment functions — comment_internal","title":"Internal comment functions — comment_internal","text":"Users advised use wb_add_comment() wb_remove_comment(). function used internally openxlsx2. stop exporting point future. Use replacement function earliest convenience.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Internal comment functions — comment_internal","text":"","code":"write_comment( wb, sheet, col = NULL, row = NULL, comment, dims = rowcol_to_dim(row, col) ) remove_comment( wb, sheet, col = NULL, row = NULL, gridExpand = TRUE, dims = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Internal comment functions — comment_internal","text":"wb workbook object sheet worksheet workbook row, col Row column cell comment object created create_comment() dims Optional row column spreadsheet dimension, e.g. \"A1\" gridExpand TRUE, data rectangle min(rows):max(rows) X min(cols):max(cols) removed.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Internal comment functions — comment_internal","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") # add a comment without author c1 <- wb_comment(text = \"this is a comment\", author = \"\") wb$add_comment(dims = \"B10\", comment = c1) #' # Remove comment wb$remove_comment(sheet = \"Sheet 1\", dims = \"B10\") # Write another comment with author information c2 <- wb_comment(text = \"this is another comment\", author = \"Marco Polo\", visible = TRUE) wb$add_comment(sheet = 1, dims = \"C10\", comment = c2) # Works with formatted text also. formatted_text <- fmt_txt(\"bar\", underline = TRUE) wb$add_comment(dims = \"B5\", comment = formatted_text)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convertToExcelDate.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert to Excel data — convertToExcelDate","title":"Convert to Excel data — convertToExcelDate","text":"Use convert_to_excel_date() new code","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convertToExcelDate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert to Excel data — convertToExcelDate","text":"df dataframe date1904 take different origin","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert from Excel date, datetime or hms number to R Date type — convert_date","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"Convert Excel date number R Date type","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"","code":"convert_date(x, origin = \"1900-01-01\", ...) convert_datetime(x, origin = \"1900-01-01\", ...) convert_hms(x)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"x vector integers origin date. Default value Windows Excel 2010 ... Arguments passed base::.Date","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"date, datetime, hms.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"Excel stores dates number days origin day","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"","code":"# date -- ## 2014 April 21st to 25th convert_date(c(41750, 41751, 41752, 41753, 41754, NA)) #> [1] \"2014-04-21\" \"2014-04-22\" \"2014-04-23\" \"2014-04-24\" \"2014-04-25\" #> [6] NA convert_date(c(41750.2, 41751.99, NA, 41753)) #> [1] \"2014-04-21\" \"2014-04-22\" NA \"2014-04-24\" # datetime -- ## 2014-07-01, 2014-06-30, 2014-06-29 x <- c(41821.8127314815, 41820.8127314815, NA, 41819, NaN) convert_datetime(x) #> [1] \"2014-07-01 19:30:20 UTC\" \"2014-06-30 19:30:20 UTC\" #> [3] NA \"2014-06-29 00:00:00 UTC\" #> [5] NA convert_datetime(x, tz = \"Australia/Perth\") #> [1] \"2014-07-01 11:30:20 UTC\" \"2014-06-30 11:30:20 UTC\" #> [3] NA \"2014-06-28 16:00:00 UTC\" #> [5] NA convert_datetime(x, tz = \"UTC\") #> [1] \"2014-07-01 19:30:20 UTC\" \"2014-06-30 19:30:20 UTC\" #> [3] NA \"2014-06-29 00:00:00 UTC\" #> [5] NA # hms --- ## 12:13:14 x <- 0.50918982 convert_hms(x) #> [1] \"12:13:14\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":null,"dir":"Reference","previous_headings":"","what":"convert back to an Excel Date — convert_to_excel_date","title":"convert back to an Excel Date — convert_to_excel_date","text":"convert back Excel Date","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"convert back to an Excel Date — convert_to_excel_date","text":"","code":"convert_to_excel_date(df, date1904 = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"convert back to an Excel Date — convert_to_excel_date","text":"df dataframe date1904 take different origin","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"convert back to an Excel Date — convert_to_excel_date","text":"","code":"xlsxFile <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb1 <- wb_load(xlsxFile) df <- wb_to_df(wb1) # conversion is done on dataframes only convert_to_excel_date(df = df[\"Var5\"], date1904 = FALSE) #> Var5 #> 3 45075 #> 4 45069 #> 5 44958 #> 6 NA #> 7 NA #> 8 44987 #> 9 NA #> 10 45284 #> 11 45285 #> 12 45138"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_border.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a border — create_border","title":"Helper to create a border — create_border","text":"Border styles can following: \"thin\", \"thick\", \"slantDashDot\", \"none\", \"mediumDashed\", \"mediumDashDot\", \"medium\", \"hair\", \"double\", \"dotted\", \"dashed\", \"dashedDotDot\", \"dashDot\" Border colors can created wb_color()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_border.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a border — create_border","text":"","code":"create_border( diagonal_down = \"\", diagonal_up = \"\", outline = \"\", bottom = NULL, bottom_color = NULL, diagonal = NULL, diagonal_color = NULL, end = \"\", horizontal = \"\", left = NULL, left_color = NULL, right = NULL, right_color = NULL, start = \"\", top = NULL, top_color = NULL, vertical = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_border.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a border — create_border","text":"diagonal_down x diagonal_up x outline x bottom X bottom_color, diagonal_color, left_color, right_color, top_color color created wb_color() diagonal X end x, horizontal x left x right x start x top x vertical x ... x","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_cell_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a cell style — create_cell_style","title":"Helper to create a cell style — create_cell_style","text":"Create_cell_style wb_add_cell_style()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_cell_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a cell style — create_cell_style","text":"","code":"create_cell_style( border_id = \"\", fill_id = \"\", font_id = \"\", num_fmt_id = \"\", pivot_button = \"\", quote_prefix = \"\", xf_id = \"\", horizontal = \"\", indent = \"\", justify_last_line = \"\", reading_order = \"\", relative_indent = \"\", shrink_to_fit = \"\", text_rotation = \"\", vertical = \"\", wrap_text = \"\", ext_lst = \"\", hidden = \"\", locked = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_cell_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a cell style — create_cell_style","text":"border_id dummy fill_id dummy font_id dummy num_fmt_id numFmt ID builtin style pivot_button dummy quote_prefix dummy xf_id dummy horizontal alignment can \"\", \"center\", \"right\" indent dummy justify_last_line dummy reading_order dummy relative_indent dummy shrink_to_fit dummy text_rotation dummy vertical alignment can \"\", \"center\", \"right\" wrap_text dummy ext_lst dummy hidden dummy locked dummy ... reserved additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a comment — create_comment","title":"Create a comment — create_comment","text":"Use wb_comment() new code. See openxlsx2-deprecated","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a comment — create_comment","text":"","code":"create_comment( text, author = Sys.info()[[\"user\"]], style = NULL, visible = TRUE, width = 2, height = 4 )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a comment — create_comment","text":"text Comment text. Character vector. fmt_txt() string. author string, default, use \"user\" style Style object list style objects length comment vector. visible Default: TRUE. comment visible default? width Textbox integer width number cells height Textbox integer height number cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a comment — create_comment","text":"wbComment object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a custom formatting style — create_dxfs_style","title":"Create a custom formatting style — create_dxfs_style","text":"Create new style apply worksheet cells. Created styles assigned workbook use ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a custom formatting style — create_dxfs_style","text":"","code":"create_dxfs_style( font_name = NULL, font_size = NULL, font_color = NULL, num_fmt = NULL, border = NULL, border_color = wb_color(getOption(\"openxlsx2.borderColor\", \"black\")), border_style = getOption(\"openxlsx2.borderStyle\", \"thin\"), bg_fill = NULL, fg_color = NULL, gradient_fill = NULL, text_bold = NULL, text_strike = NULL, text_italic = NULL, text_underline = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a custom formatting style — create_dxfs_style","text":"font_name name font. Note font name validated. font_name NULL, workbook base_font used. (Defaults Calibri), see wb_get_base_font() font_size Font size. numeric greater 0. default, workbook base font size used. (Defaults 11) font_color Color text cell. valid hex color beginning \"#\" one colors(). font_color NULL, workbook base font colors used. (Defaults black) num_fmt Cell formatting. custom openxml format border NULL TRUE border_color \"black\" border_style \"thin\" bg_fill Cell background fill color. fg_color Cell foreground fill color. gradient_fill xml string beginning ... text_bold bold text_strike strikeout text_italic italic text_underline underline 1, true, single double ... Additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a custom formatting style — create_dxfs_style","text":"dxfs style node","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a custom formatting style — create_dxfs_style","text":"possible override border_color border_style {left, right, top, bottom}_color, {left, right, top, bottom}_style.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a custom formatting style — create_dxfs_style","text":"","code":"# do not apply anything style1 <- create_dxfs_style() # change font color and background color style2 <- create_dxfs_style( font_color = wb_color(hex = \"FF9C0006\"), bgFill = wb_color(hex = \"FFFFC7CE\") ) # change font (type, size and color) and background # the old default in openxlsx and openxlsx2 <= 0.3 style3 <- create_dxfs_style( font_name = \"Calibri\", font_size = 11, font_color = wb_color(hex = \"FF9C0006\"), bgFill = wb_color(hex = \"FFFFC7CE\") ) ## See package vignettes for further examples"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_fill.html","id":null,"dir":"Reference","previous_headings":"","what":"create fill — create_fill","title":"create fill — create_fill","text":"create fill","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_fill.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create fill — create_fill","text":"","code":"create_fill( gradientFill = \"\", patternType = \"\", bgColor = NULL, fgColor = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_fill.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create fill — create_fill","text":"gradientFill complex fills patternType various: default \"none\", also \"solid\", color like \"gray125\" bgColor hex8 color alpha, red, green, blue patternFill fgColor hex8 color alpha, red, green, blue patternFill ... ...","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":null,"dir":"Reference","previous_headings":"","what":"create font format — create_font","title":"create font format — create_font","text":"create font format","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create font format — create_font","text":"","code":"create_font( b = \"\", charset = \"\", color = wb_color(hex = \"FF000000\"), condense = \"\", extend = \"\", family = \"2\", i = \"\", name = \"Calibri\", outline = \"\", scheme = \"minor\", shadow = \"\", strike = \"\", sz = \"11\", u = \"\", vert_align = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create font format — create_font","text":"b bold charset charset color rgb color: default \"FF000000\" condense condense extend extend family font family: default \"2\" italic name font name: default \"Calibri\" outline outline scheme font scheme: default \"minor\" shadow shadow strike strike sz font size: default \"11\", u underline vert_align vertical alignment ... ...","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create font format — create_font","text":"","code":"font <- create_font() # openxml has the alpha value leading hex8 <- unlist(xml_attr(read_xml(font), \"font\", \"color\")) hex8 <- paste0(\"#\", substr(hex8, 3, 8), substr(hex8, 1, 2)) # # write test color # col <- crayon::make_style(col2rgb(hex8, alpha = TRUE)) # cat(col(\"Test\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":null,"dir":"Reference","previous_headings":"","what":"Create Excel hyperlink string — create_hyperlink","title":"Create Excel hyperlink string — create_hyperlink","text":"Wrapper create internal hyperlink string pass write_formula(). Either link external URLs local files straight cells local Excel sheets.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create Excel hyperlink string — create_hyperlink","text":"","code":"create_hyperlink(sheet, row = 1, col = 1, text = NULL, file = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create Excel hyperlink string — create_hyperlink","text":"sheet Name worksheet row integer row number hyperlink link col column number letter hyperlink link text display text file Excel file name point . NULL hyperlink internal.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create Excel hyperlink string — create_hyperlink","text":"","code":"wb <- wb_workbook()$ add_worksheet(\"Sheet1\")$add_worksheet(\"Sheet2\")$add_worksheet(\"Sheet3\") ## Internal Hyperlink - create hyperlink formula manually x <- '=HYPERLINK(\\\"#Sheet2!B3\\\", \"Text to Display - Link to Sheet2\")' wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A1\") ## Internal - No text to display using create_hyperlink() function x <- create_hyperlink(sheet = \"Sheet3\", row = 1, col = 2) wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A2\") ## Internal - Text to display x <- create_hyperlink(sheet = \"Sheet3\", row = 1, col = 2,text = \"Link to Sheet 3\") wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A3\") ## Link to file - No text to display fl <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") x <- create_hyperlink(sheet = \"Sheet1\", row = 3, col = 10, file = fl) wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A4\") ## Link to file - Text to display fl <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") x <- create_hyperlink(sheet = \"Sheet2\", row = 3, col = 10, file = fl, text = \"Link to File.\") wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A5\") ## Link to external file - Text to display x <- '=HYPERLINK(\"[C:/Users]\", \"Link to an external file\")' wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A6\") x <- create_hyperlink(text = \"test.png\", file = \"D:/somepath/somepicture.png\") wb$add_formula(x = x, dims = \"A7\") # if (interactive()) wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_numfmt.html","id":null,"dir":"Reference","previous_headings":"","what":"create number format — create_numfmt","title":"create number format — create_numfmt","text":"create number format","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_numfmt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create number format — create_numfmt","text":"","code":"create_numfmt(numFmtId, formatCode)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_numfmt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create number format — create_numfmt","text":"numFmtId id, list can found Details create_cell_style() formatCode format code","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":null,"dir":"Reference","previous_headings":"","what":"Create sparklines object — create_sparklines","title":"Create sparklines object — create_sparklines","text":"Create sparkline added workbook wb_add_sparklines()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create sparklines object — create_sparklines","text":"","code":"create_sparklines( sheet = current_sheet(), dims, sqref, type = NULL, negative = NULL, displayEmptyCellsAs = \"gap\", markers = NULL, high = NULL, low = NULL, first = NULL, last = NULL, colorSeries = wb_color(hex = \"FF376092\"), colorNegative = wb_color(hex = \"FFD00000\"), colorAxis = wb_color(hex = \"FFD00000\"), colorMarkers = wb_color(hex = \"FFD00000\"), colorFirst = wb_color(hex = \"FFD00000\"), colorLast = wb_color(hex = \"FFD00000\"), colorHigh = wb_color(hex = \"FFD00000\"), colorLow = wb_color(hex = \"FFD00000\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create sparklines object — create_sparklines","text":"sheet sheet dims Cell range cells used create sparklines sqref Cell range destination sparklines. type type negative negative displayEmptyCellsAs displayEmptyCellsAs markers markers add marker line high highlight highest value low highlight lowest value first highlight first value last highlight last value colorSeries colorSeries colorNegative colorNegative colorAxis colorAxis colorMarkers colorMarkers colorFirst colorFirst colorLast colorLast colorHigh colorHigh colorLow colorLow","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create sparklines object — create_sparklines","text":"string containing XML code","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create sparklines object — create_sparklines","text":"Colors predefined rgb. Maybe theme colors can used .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create sparklines object — create_sparklines","text":"","code":"# create sparklineGroup sparklines <- c( create_sparklines(\"Sheet 1\", \"A3:L3\", \"M3\", type = \"column\", first = \"1\"), create_sparklines(\"Sheet 1\", \"A2:L2\", \"M2\", markers = \"1\"), create_sparklines(\"Sheet 1\", \"A4:L4\", \"M4\", type = \"stacked\", negative = \"1\") ) t1 <- AirPassengers t2 <- do.call(cbind, split(t1, cycle(t1))) dimnames(t2) <- dimnames(.preformat.ts(t1)) wb <- wb_workbook()$ add_worksheet(\"Sheet 1\")$ add_data(x = t2)$ add_sparklines(sparklines = sparklines)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_tablestyle.html","id":null,"dir":"Reference","previous_headings":"","what":"create tableStyle — create_tablestyle","title":"create tableStyle — create_tablestyle","text":"Create custom table style. function expert use . Use styling functions instead.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_tablestyle.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create tableStyle — create_tablestyle","text":"","code":"create_tablestyle( name, whole_table = NULL, header_row = NULL, total_row = NULL, first_column = NULL, last_column = NULL, first_row_stripe = NULL, second_row_stripe = NULL, first_column_stripe = NULL, second_column_stripe = NULL, first_header_cell = NULL, last_header_cell = NULL, first_total_cell = NULL, last_total_cell = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_tablestyle.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create tableStyle — create_tablestyle","text":"name name whole_table wholeTable header_row headerRow total_row totalRow first_column firstColumn last_column lastColumn first_row_stripe firstRowStripe second_row_stripe secondRowStripe first_column_stripe firstColumnStripe second_column_stripe secondColumnStripe first_header_cell firstHeaderCell last_header_cell lastHeaderCell first_total_cell firstTotalCell last_total_cell lastTotalCell ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify creators of a workbook — creators-wb","title":"Modify creators of a workbook — creators-wb","text":"Modify get workbook creators","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify creators of a workbook — creators-wb","text":"","code":"wb_add_creators(wb, creators) wb_set_creators(wb, creators) wb_remove_creators(wb, creators) wb_get_creators(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify creators of a workbook — creators-wb","text":"wb wbWorkbook object creators character vector names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify creators of a workbook — creators-wb","text":"wb_set_creators(), wb_add_creators(), wb_remove_creators() return wbWorkbook object wb_get_creators() returns character vector creators","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify creators of a workbook — creators-wb","text":"","code":"# workbook made with default creator (see [wbWorkbook]) wb <- wb_workbook() wb_get_creators(wb) #> [1] \"runner\" # add a new creator (assuming \"test\" isn't your default creator) wb <- wb_add_creators(wb, \"test\") wb_get_creators(wb) #> [1] \"runner\" \"test\" # remove the creator (should be the same as before) wb <- wb_remove_creators(wb, \"test\") wb_get_creators(wb) #> [1] \"runner\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":null,"dir":"Reference","previous_headings":"","what":"Create dimensions from dataframe — dataframe_to_dims","title":"Create dimensions from dataframe — dataframe_to_dims","text":"Use wb_dims()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create dimensions from dataframe — dataframe_to_dims","text":"","code":"dataframe_to_dims(df)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create dimensions from dataframe — dataframe_to_dims","text":"df dataframe spreadsheet columns rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create dimensions from dataframe — dataframe_to_dims","text":"","code":"df <- dims_to_dataframe(\"A1:D5;F1:F6;D8\", fill = TRUE) dataframe_to_dims(df) #> [1] \"A1:D6;A8:D8;F1:F6;F8:F8\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/delete_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Delete data — delete_data","title":"Delete data — delete_data","text":"function deprecated. Use wb_clean_sheet().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/delete_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Delete data — delete_data","text":"","code":"delete_data(wb, sheet, cols, rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/delete_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Delete data — delete_data","text":"wb workbook sheet sheet clean cols numeric column vector rows numeric row vector","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper functions to work with dims — dims_helper","title":"Helper functions to work with dims — dims_helper","text":"Internal helpers (de)construct dims argument /row column vector. Exported user convenience.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper functions to work with dims — dims_helper","text":"","code":"dims_to_rowcol(x, as_integer = FALSE) rowcol_to_dims(row, col)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper functions to work with dims — dims_helper","text":"x dimension object \"A1\" \"A1:A1\" as_integer output returned integer, (defaults string) row numeric vector rows col numeric character vector cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper functions to work with dims — dims_helper","text":"dims string _to_dim .e \"A1:A1\" list rows columns to_rowcol","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper functions to work with dims — dims_helper","text":"","code":"dims_to_rowcol(\"A1:J10\") #> [[1]] #> [1] \"A\" \"B\" \"C\" \"D\" \"E\" \"F\" \"G\" \"H\" \"I\" \"J\" #> #> [[2]] #> [1] \"1\" \"2\" \"3\" \"4\" \"5\" \"6\" \"7\" \"8\" \"9\" \"10\" #> wb_dims(1:10, 1:10) #> [1] \"A1:J10\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":null,"dir":"Reference","previous_headings":"","what":"Create dataframe from dimensions — dims_to_dataframe","title":"Create dataframe from dimensions — dims_to_dataframe","text":"Create dataframe dimensions","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create dataframe from dimensions — dims_to_dataframe","text":"","code":"dims_to_dataframe(dims, fill = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create dataframe from dimensions — dims_to_dataframe","text":"dims Character vector expected dimension. fill TRUE, fills dataframe variables","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create dataframe from dimensions — dims_to_dataframe","text":"","code":"dims_to_dataframe(\"A1:B2\") #> A B #> 1 #> 2 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Add/remove column filters in a worksheet — filter-wb","title":"Add/remove column filters in a worksheet — filter-wb","text":"Add remove excel column filters worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add/remove column filters in a worksheet — filter-wb","text":"","code":"wb_add_filter(wb, sheet = current_sheet(), rows, cols) wb_remove_filter(wb, sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add/remove column filters in a worksheet — filter-wb","text":"wb workbook object sheet worksheet name index. wb_remove_filter(), may supply vector worksheets. rows row number. cols columns add filter .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add/remove column filters in a worksheet — filter-wb","text":"Adds filters worksheet columns, with_filter = TRUE wb_add_data() wb_add_data_table() automatically adds filters first row table. NOTE Can single filter per worksheet unless using tables.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add/remove column filters in a worksheet — filter-wb","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_worksheet(\"Sheet 3\") wb$add_data(1, iris) wb$add_filter(1, row = 1, cols = seq_along(iris)) ## Equivalently wb$add_data(2, x = iris, withFilter = TRUE) ## Similarly wb$add_data_table(3, iris) wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_worksheet(\"Sheet 3\") wb$add_data(1, iris) wb_add_filter(wb, 1, row = 1, cols = seq_along(iris)) ## Equivalently wb$add_data(2, x = iris, with_filter = TRUE) ## Similarly wb$add_data_table(3, iris) ## remove filters wb_remove_filter(wb, 1:2) ## remove filters wb_remove_filter(wb, 3) ## Does not affect tables!"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":null,"dir":"Reference","previous_headings":"","what":"format strings independent of the cell style. — fmt_txt","title":"format strings independent of the cell style. — fmt_txt","text":"format strings independent cell style.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"format strings independent of the cell style. — fmt_txt","text":"","code":"fmt_txt( x, bold = FALSE, italic = FALSE, underline = FALSE, strike = FALSE, size = NULL, color = NULL, font = NULL, charset = NULL, outline = NULL, vert_align = NULL ) # S3 method for fmt_txt +(x, y) # S3 method for fmt_txt as.character(x, ...) # S3 method for fmt_txt print(x, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"format strings independent of the cell style. — fmt_txt","text":"x, y openxlsx2 fmt_txt string bold bold italic italic underline underline strike strike size font size color wbColor color font font font name charset integer value table outline TRUE FALSE vert_align baseline, superscript, subscript ... additional arguments default print","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"format strings independent of the cell style. — fmt_txt","text":"result xml string. possible paste multiple fmt_txt() strings together create string differing styles. Using fmt_txt(charset = 161) give Greek Character Set can join additional objects fmt_txt() objects using \"+\". Though aware fmt_txt(\"sum:\") + (2 + 2) different fmt_txt(\"sum:\") + 2 + 2.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"format strings independent of the cell style. — fmt_txt","text":"","code":"fmt_txt(\"bar\", underline = TRUE) #> fmt_txt string: #> [1] \"bar\" fmt_txt(\"foo \", bold = TRUE) + fmt_txt(\"bar\") #> fmt_txt string: #> [1] \"foo bar\" as.character(fmt_txt(2)) #> [1] \"2\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Group rows and columns in a worksheet — grouping-wb","title":"Group rows and columns in a worksheet — grouping-wb","text":"Group selection rows cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Group rows and columns in a worksheet — grouping-wb","text":"","code":"wb_group_cols( wb, sheet = current_sheet(), cols, collapsed = FALSE, levels = NULL ) wb_ungroup_cols(wb, sheet = current_sheet(), cols) wb_group_rows( wb, sheet = current_sheet(), rows, collapsed = FALSE, levels = NULL ) wb_ungroup_rows(wb, sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Group rows and columns in a worksheet — grouping-wb","text":"wb wbWorkbook object sheet name index worksheet collapsed TRUE grouped columns collapsed levels levels rows, cols Indices rows columns group","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Group rows and columns in a worksheet — grouping-wb","text":"row previously hidden, now shown.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Group rows and columns in a worksheet — grouping-wb","text":"","code":"# create matrix t1 <- AirPassengers t2 <- do.call(cbind, split(t1, cycle(t1))) dimnames(t2) <- dimnames(.preformat.ts(t1)) wb <- wb_workbook() wb$add_worksheet(\"AirPass\") wb$add_data(\"AirPass\", t2, rowNames = TRUE) # groups will always end on/show the last row. in the example 1950, 1955, and 1960 wb <- wb_group_rows(wb, \"AirPass\", 2:3, collapsed = TRUE) # group years < 1950 wb <- wb_group_rows(wb, \"AirPass\", 4:8, collapsed = TRUE) # group years 1951-1955 wb <- wb_group_rows(wb, \"AirPass\", 9:13) # group years 1956-1960 wb <- wb_group_cols(wb, \"AirPass\", 2:4, collapsed = TRUE) wb <- wb_group_cols(wb, \"AirPass\", 5:7, collapsed = TRUE) wb <- wb_group_cols(wb, \"AirPass\", 8:10, collapsed = TRUE) wb <- wb_group_cols(wb, \"AirPass\", 11:13) ### create grouping levels grp_rows <- list( \"1\" = seq(2, 3), \"2\" = seq(4, 8), \"3\" = seq(9, 13) ) grp_cols <- list( \"1\" = seq(2, 4), \"2\" = seq(5, 7), \"3\" = seq(8, 10), \"4\" = seq(11, 13) ) wb <- wb_workbook() wb$add_worksheet(\"AirPass\") wb$add_data(\"AirPass\", t2, rowNames = TRUE) wb$group_cols(\"AirPass\", cols = grp_cols) wb$group_rows(\"AirPass\", rows = grp_rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert integer to Excel column — int2col","title":"Convert integer to Excel column — int2col","text":"Converts integer Excel column label.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert integer to Excel column — int2col","text":"","code":"int2col(x)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert integer to Excel column — int2col","text":"x numeric vector.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert integer to Excel column — int2col","text":"","code":"int2col(1:10) #> [1] \"A\" \"B\" \"C\" \"D\" \"E\" \"F\" \"G\" \"H\" \"I\" \"J\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify named regions in a worksheet — named_region-wb","title":"Modify named regions in a worksheet — named_region-wb","text":"Create / delete named region. can also specify named region using name argument wb_add_data(x = iris, name = \"-region\"). important note named regions case-sensitive must unique.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify named regions in a worksheet — named_region-wb","text":"","code":"wb_add_named_region( wb, sheet = current_sheet(), dims = \"A1\", name, local_sheet = FALSE, overwrite = FALSE, comment = NULL, hidden = NULL, custom_menu = NULL, description = NULL, is_function = NULL, function_group_id = NULL, help = NULL, local_name = NULL, publish_to_server = NULL, status_bar = NULL, vb_procedure = NULL, workbook_parameter = NULL, xml = NULL, ... ) wb_remove_named_region(wb, sheet = current_sheet(), name = NULL) wb_get_named_regions(wb, tables = FALSE, x = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify named regions in a worksheet — named_region-wb","text":"wb Workbook object sheet name index worksheet dims Worksheet cell range region (\"A1:D4\"). name Name region. character vector length 1. Note region names must case-insensitive unique. local_sheet TRUE named region local sheet overwrite Boolean. Overwrite exists? Default FALSE. comment description text named region hidden named region hidden? custom_menu, description, is_function, function_group_id, help, local_name, publish_to_server, status_bar, vb_procedure, workbook_parameter, xml Unknown XML feature ... additional arguments tables included data tables named regions result? x Deprecated. Use wb. Excel input use wb_load() first load xlsx file workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify named regions in a worksheet — named_region-wb","text":"workbook, invisibly. data frame named regions wb. NULL, none found.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify named regions in a worksheet — named_region-wb","text":"can use wb_dims() helper specify cell range named region","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify named regions in a worksheet — named_region-wb","text":"","code":"## create named regions wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") ## specify region wb$add_data(x = iris, start_col = 1, start_row = 1) wb$add_named_region( name = \"iris\", dims = wb_dims(x = iris) ) ## using add_data 'name' argument wb$add_data(sheet = 1, x = iris, name = \"iris2\", start_col = 10) ## delete one wb$remove_named_region(name = \"iris2\") wb$get_named_regions() #> name value sheets coords id local sheet #> 1 iris 'Sheet 1'!$A$1:$E$151 Sheet 1 A1:E151 1 0 1 ## read named regions df <- wb_to_df(wb, named_region = \"iris\") head(df) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 2 5.1 3.5 1.4 0.2 setosa #> 3 4.9 3.0 1.4 0.2 setosa #> 4 4.7 3.2 1.3 0.2 setosa #> 5 4.6 3.1 1.5 0.2 setosa #> 6 5.0 3.6 1.4 0.2 setosa #> 7 5.4 3.9 1.7 0.4 setosa # Extract named regions from a file out_file <- temp_xlsx() wb_save(wb, out_file, overwrite = TRUE) # Load the file as a workbook first, then get named regions. wb1 <- wb_load(out_file) wb1$get_named_regions() #> name value sheets coords id local sheet #> 1 iris 'Sheet 1'!$A$1:$E$151 Sheet 1 A1:E151 1 0 1"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":null,"dir":"Reference","previous_headings":"","what":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"functions provided compatibility older versions openxlsx2, may defunct soon next release. guide helps update code latest standards. openxlsx2 v1.0, API change minimal.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"internal-functions","dir":"Reference","previous_headings":"","what":"Internal functions","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"functions used internally openxlsx2. longer advertised use scripts. originate openxlsx, fit openxlsx2's API. able modify delete_data() -> wb_clean_sheet() write_comment() -> wb_add_comment() remove_comment() -> wb_remove_comment() write_formula() -> wb_add_formula() able change minimal changes","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"deprecated-functions","dir":"Reference","previous_headings":"","what":"Deprecated functions","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"First , can set option add warnings using deprecated functions.","code":"options(\"openxlsx2.soon_deprecated\" = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"argument-changes","dir":"Reference","previous_headings":"","what":"Argument changes","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"consistency, arguments renamed snake_case 0.8 release. now recommended use dims (cell range) favor row, col, start_row, start_col See wb_dims() provides many options provide cell range","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"functions-with-a-new-name","dir":"Reference","previous_headings":"","what":"Functions with a new name","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"functions renamed consistency. convertToExcelDate() -> convert_to_excel_date() wb_grid_lines() -> wb_set_grid_lines() create_comment() -> wb_comment()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"deprecated-usage","dir":"Reference","previous_headings":"","what":"Deprecated usage","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"wb_get_named_regions() longer allow providing file.","code":"## Before wb_get_named_regions(file) ## Now wb <- wb_load(file) wb_get_named_regions(wb) # also possible wb_load(file)$get_named_regions()`"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":null,"dir":"Reference","previous_headings":"","what":"xlsx reading, writing and editing. — openxlsx2-package","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"R package modern reinterpretation widely used popular openxlsx package. Similar predecessor, simplifies creation xlsx files providing clean interface writing, designing editing worksheets. Based powerful XML library focusing modern programming flows pipes chains, openxlsx2 allows break many new ground.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"default, openxlsx2 uses American English word color (written 'o' instead British English 'ou'). However, spellings supported. documentation uses 'color', function also accept 'colour'. However, indicated autocompletion.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"authors-and-contributions","dir":"Reference","previous_headings":"","what":"Authors and contributions","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"full list authors made package possible grateful, please see: feel like included list, please let us know. something contribute, welcome. something working expected, open issues solved issue, open pull request. Please respectful aware volunteers fun unpaid free time. work problems time need.","code":"system.file(\"AUTHORS\", package = \"openxlsx2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"license","dir":"Reference","previous_headings":"","what":"License","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"package licensed MIT license based openxlsx (Alexander Walker Philipp Schauberger; COPYRIGHT 2014-2022) pugixml (Arseny Kapoulkine; COPYRIGHT 2006-2022). released MIT license.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"Maintainer: Jan Marvin Garbuszus jan.garbuszus@ruhr-uni-bochum.de Authors: Jordan Mark Barbone jmbarbone@gmail.com (ORCID) contributors: Oliver Roy [contributor] openxlsx authors (openxlsx package) [copyright holder] Arseny Kapoulkine (Author included pugixml code) [contributor, copyright holder]","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Options consulted by openxlsx2 — openxlsx2_options","title":"Options consulted by openxlsx2 — openxlsx2_options","text":"openxlsx2 package allows user set global options simplify formatting: built-defaults suit , set one options. Typically, done .Rprofile startup file options(\"openxlsx2.borderColor\" = \"black\") options(\"openxlsx2.borderStyle\" = \"thin\") options(\"openxlsx2.dateFormat\" = \"mm/dd/yyyy\") options(\"openxlsx2.datetimeFormat\" = \"yyyy-mm-dd hh:mm:ss\") options(\"openxlsx2.maxWidth\" = NULL) (Maximum width allowed Excel 250) options(\"openxlsx2.minWidth\" = NULL) options(\"openxlsx2.numFmt\" = NULL) options(\"openxlsx2.paperSize\" = 9) corresponds A4 paper size options(\"openxlsx2.orientation\" = \"portrait\") page orientation options(\"openxlsx2.sheet.default_name\" = \"Sheet\") options(\"openxlsx2.rightToLeft\" = NULL) options(\"openxlsx2.soon_deprecated\" = FALSE) Set TRUE want warning using functions deprecated recently openxlsx2 options(\"openxlsx2.creator\") default name creator new wbWorkbook object wb_workbook() new comments wb_add_comment() options(\"openxlsx2.thread_id\") default person id adding threaded comment cell wb_add_thread() options(\"openxlsx2.accountingFormat\" = 4) options(\"openxlsx2.commaFormat\" = 3) options(\"openxlsx2.percentageFormat\" = 10) options(\"openxlsx2.scientificFormat\" = 48)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/person-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for adding threaded comments — person-wb","title":"Helper for adding threaded comments — person-wb","text":"Adds person workbook, can author threaded comments workbook wb_add_thread()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/person-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper for adding threaded comments — person-wb","text":"","code":"wb_add_person(wb, name = NULL, id = NULL, user_id = NULL, provider_id = \"None\") wb_get_person(wb, name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/person-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for adding threaded comments — person-wb","text":"wb Workbook name name person display. id (optional) display id user_id (optional) user id provider_id (optional) provider id","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"print pugi_xml — print.pugi_xml","title":"print pugi_xml — print.pugi_xml","text":"print pugi_xml","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print pugi_xml — print.pugi_xml","text":"","code":"# S3 method for pugi_xml print(x, indent = \" \", raw = FALSE, attr_indent = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print pugi_xml — print.pugi_xml","text":"x something print indent indent used default \" \" raw print raw text attr_indent print attributes indented new line ... please check","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"print pugi_xml — print.pugi_xml","text":"","code":"# a pointer x <- read_xml(\"<\/a>\") print(x) #> #> #> <\/a> print(x, raw = TRUE) #> <\/a>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify workbook properties — properties-wb","title":"Modify workbook properties — properties-wb","text":"function useful workbooks loaded. can used set workbook title, subject category field. Use wb_workbook() easily set properties new workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify workbook properties — properties-wb","text":"","code":"wb_get_properties(wb) wb_set_properties( wb, creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), modifier = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify workbook properties — properties-wb","text":"wb Workbook object creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords, comments, manager, company Workbook property, string. datetime_created time workbook created modifier character string indicating last person modify workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify workbook properties — properties-wb","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify workbook properties — properties-wb","text":"set properties, following XML core properties used. title = dc:title subject = dc:subject creator = dc:creator keywords = cp:keywords comments = dc:description modifier = cp:lastModifiedBy datetime_created = dcterms:created datetime_modified = dcterms:modified category = cp:category addition, manager company used.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify workbook properties — properties-wb","text":"","code":"file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb <- wb_load(file) wb$get_properties() #> creator modifier datetime_created #> \"Jan Marvin Garbuszus\" \"Jan Marvin Garbuszus\" \"2023-05-29T07:43:12Z\" #> datetime_modified company #> \"2023-05-29T10:47:37Z\" \"\" # Add a title to properties wb$set_properties(title = \"my title\") wb$get_properties() #> creator modifier datetime_created #> \"Jan Marvin Garbuszus\" \"Jan Marvin Garbuszus\" \"2023-11-16T18:30:37Z\" #> datetime_modified title company #> \"2023-05-29T10:47:37Z\" \"my title\" \"\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":null,"dir":"Reference","previous_headings":"","what":"xml_node — pugixml","title":"xml_node — pugixml","text":"returns xml values character","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"xml_node — pugixml","text":"","code":"xml_node(xml, level1 = NULL, level2 = NULL, level3 = NULL, ...) xml_node_name(xml, level1 = NULL, level2 = NULL, ...) xml_value(xml, level1 = NULL, level2 = NULL, level3 = NULL, ...) xml_attr(xml, level1 = NULL, level2 = NULL, level3 = NULL, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"xml_node — pugixml","text":"xml something xml level1 please check level2 please check level3 please check ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"xml_node — pugixml","text":"function returns XML nodes used openxlsx2. theory returned pointers well, yet implemented. level provided, nodes level1 returned","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"xml_node — pugixml","text":"","code":"x <- read_xml(\"<\/a>\") # return a xml_node(x, \"a\") #> [1] \"<\/a>\" # return b. requires the path to the node xml_node(x, \"a\", \"b\") #> [1] \"\" xml_node_name(\"\") #> [1] \"a\" xml_node_name(\"<\/a>\", \"a\") #> [1] \"b\" x <- read_xml(\"1<\/a>\") xml_value(x, \"a\") #> [1] \"1\" x <- read_xml(\"2<\/b><\/a>\") xml_value(x, \"a\", \"b\") #> [1] \"2\" x <- read_xml(\"1<\/a>\") xml_attr(x, \"a\") #> [[1]] #> a b #> \"1\" \"2\" #> x <- read_xml(\"2<\/b><\/a>\") xml_attr(x, \"a\", \"b\") #> [[1]] #> r #> \"1\" #> x <- read_xml(\"1<\/a>\") xml_attr(x, \"a\") #> [[1]] #> a b #> \"1\" \"2\" #> x <- read_xml(\"<\/b>\") xml_attr(x, \"b\", \"a\") #> [[1]] #> a b #> \"1\" \"2\" #>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"read xml file — read_xml","title":"read xml file — read_xml","text":"read xml file","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read xml file — read_xml","text":"","code":"read_xml( xml, pointer = TRUE, escapes = FALSE, declaration = FALSE, whitespace = TRUE, empty_tags = FALSE, skip_control = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read xml file — read_xml","text":"xml something read character string file pointer pointer returned? escapes bool characters like \"&\" escaped. default escapes. Assuming input already provides valid information. declaration declaration imported whitespace whitespace pcdata imported empty_tags <\/b> returned skip_control whitespace character exported","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"read xml file — read_xml","text":"Read xml files strings pointer checks input valid XML. input read character object, reevaluated every time called. pointer evaluated , lives lifetime R session gc().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read xml file — read_xml","text":"","code":"# a pointer x <- read_xml(\"<\/a>\") print(x) #> #> #> <\/a> print(x, raw = TRUE) #> <\/a> str(x) #> Class 'pugi_xml' #> - attr(*, \"escapes\")= logi FALSE #> - attr(*, \"empty_tags\")= logi FALSE #> - attr(*, \"skip_control\")= logi TRUE # a character y <- read_xml(\"<\/a>\", pointer = FALSE) print(y) #> [1] \"<\/a>\" print(y, raw = TRUE) #> [1] \"<\/a>\" str(y) #> chr \"<\/a>\" # Errors if the import was unsuccessful try(z <- read_xml(\"\")) #> Error : xml import unsuccessful xml <- 'A & B<\/a>' # difference in escapes read_xml(xml, escapes = TRUE, pointer = FALSE) #> [1] \"A & B<\/a>\" read_xml(xml, escapes = FALSE, pointer = FALSE) #> [1] \"A & B<\/a>\" read_xml(xml, escapes = TRUE) #> A & B<\/a> read_xml(xml, escapes = FALSE) #> A & B<\/a> # read declaration read_xml(xml, declaration = TRUE) #> #> A & B<\/a>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify row heights of a worksheet — row_heights-wb","title":"Modify row heights of a worksheet — row_heights-wb","text":"Set / remove custom worksheet row heights","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify row heights of a worksheet — row_heights-wb","text":"","code":"wb_set_row_heights( wb, sheet = current_sheet(), rows, heights = NULL, hidden = FALSE ) wb_remove_row_heights(wb, sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify row heights of a worksheet — row_heights-wb","text":"wb wbWorkbook object sheet name index worksheet. (vector accepted remove_row_heights()) rows Indices rows set / remove () custom height. heights Heights set rows specified spreadsheet column height units. hidden Option hide rows. logical vector length 1 length rows","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify row heights of a worksheet — row_heights-wb","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\") ## set row heights wb <- wb_set_row_heights( wb, 1, rows = c(1, 4, 22, 2, 19), heights = c(24, 28, 32, 42, 33) ) ## overwrite row 1 height wb <- wb_set_row_heights(wb, 1, rows = 1, heights = 40) ## remove any custom row heights in row 1 wb$remove_row_heights(sheet = 1, rows = 1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Get / Set worksheet names for a workbook — sheet_names-wb","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"Gets / Sets worksheet names wbWorkbook object.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"","code":"wb_set_sheet_names(wb, old = NULL, new) wb_get_sheet_names(wb, escape = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"wb wbWorkbook object old name (index) old sheet name. NULL assume worksheets renamed. new name new sheet escape xml special characters escaped?","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"set_: wbWorkbook object. get_: named character vector sheet names order. names represent original value worksheet prior character substitutions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"changes sheet name shown spreadsheet software alter elsewhere. formulas, chart references, named regions, pivot tables anywhere else.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"Get set worksheet visible state. allows hide worksheets workbook. visibility worksheet can either \"visible\", \"hidden\", \"veryHidden\". can set creating worksheet wb_add_worksheet(visible = FALSE)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"","code":"wb_get_sheet_visibility(wb) wb_set_sheet_visibility(wb, sheet = current_sheet(), value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"wb wbWorkbook object sheet Worksheet identifier value logical/character vector length sheet, providing character vector, can provide \"hidden\", \"visible\", \"veryHidden\"","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"wb_set_sheet_visibility: Workbook object, invisibly. wb_get_sheet_visibility(): character vector worksheet visibility value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"","code":"wb <- wb_workbook() wb$add_worksheet(sheet = \"S1\", visible = FALSE) wb$add_worksheet(sheet = \"S2\", visible = TRUE) wb$add_worksheet(sheet = \"S3\", visible = FALSE) wb$get_sheet_visibility() #> [1] \"hidden\" \"visible\" \"hidden\" wb$set_sheet_visibility(1, TRUE) ## show sheet 1 wb$set_sheet_visibility(2, FALSE) ## hide sheet 2 wb$set_sheet_visibility(3, \"hidden\") ## hide sheet 3 wb$set_sheet_visibility(3, \"veryHidden\") ## hide sheet 3 from UI"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/styles_on_sheet.html","id":null,"dir":"Reference","previous_headings":"","what":"get all styles on a sheet — styles_on_sheet","title":"get all styles on a sheet — styles_on_sheet","text":"get styles sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/styles_on_sheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get all styles on a sheet — styles_on_sheet","text":"","code":"styles_on_sheet(wb, sheet)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/styles_on_sheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get all styles on a sheet — styles_on_sheet","text":"wb workbook sheet worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/temp_xlsx.html","id":null,"dir":"Reference","previous_headings":"","what":"helper function to create temporary directory for testing purpose — temp_xlsx","title":"helper function to create temporary directory for testing purpose — temp_xlsx","text":"helper function create temporary directory testing purpose","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/temp_xlsx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"helper function to create temporary directory for testing purpose — temp_xlsx","text":"","code":"temp_xlsx(name = \"temp_xlsx\", macros = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/temp_xlsx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"helper function to create temporary directory for testing purpose — temp_xlsx","text":"name temp file macros logical file extension xlsm xlsx","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/waivers.html","id":null,"dir":"Reference","previous_headings":"","what":"openxlsx2 waivers — waivers","title":"openxlsx2 waivers — waivers","text":"Waiver functions openxlsx2 functions. current_sheet() uses wb_get_active_sheet() default performing actions worksheet, example add data. next_sheet() used add new worksheet, new chartsheet add pivot table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/waivers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"openxlsx2 waivers — waivers","text":"","code":"current_sheet() next_sheet() na_strings()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/waivers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"openxlsx2 waivers — waivers","text":"object class openxlsx2_waiver","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":null,"dir":"Reference","previous_headings":"","what":"R6 class for a workbook — wbWorkbook","title":"R6 class for a workbook — wbWorkbook","text":"workbook. documentation complete wrapper functions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"public-fields","dir":"Reference","previous_headings":"","what":"Public fields","title":"R6 class for a workbook — wbWorkbook","text":"sheet_names names sheets calcChain calcChain charts charts is_chartsheet logical vector identifying sheet chartsheet. customXml customXml connections connections ctrlProps ctrlProps Content_Types Content_Types app app core XML core custom custom drawings drawings drawings_rels drawings_rels embeddings embeddings externalLinks externalLinks externalLinksRels externalLinksRels headFoot header footer media media metadata contains cell/value metadata imported load xl/metadata.xml persons Persons workbook. used wb_add_thread() pivotTables pivotTables pivotTables.xml.rels pivotTables.xml.rels pivotDefinitions pivotDefinitions pivotRecords pivotRecords pivotDefinitionsRels pivotDefinitionsRels queryTables queryTables slicers slicers slicerCaches slicerCaches sharedStrings sharedStrings styles_mgr styles_mgr tables tables tables.xml.rels tables.xml.rels theme theme vbaProject vbaProject vml vml vml_rels vml_rels comments Comments (notes) present workbook. threadComments Threaded comments workbook workbook workbook.xml.rels workbook.xml.rels worksheets worksheets worksheets_rels worksheets_rels sheetOrder sheet order. Controls ordering worksheets worksheet names. path path","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook$new() wbWorkbook$append() wbWorkbook$append_sheets() wbWorkbook$validate_sheet() wbWorkbook$add_chartsheet() wbWorkbook$add_worksheet() wbWorkbook$clone_worksheet() wbWorkbook$add_data() wbWorkbook$add_data_table() wbWorkbook$add_pivot_table() wbWorkbook$add_slicer() wbWorkbook$add_formula() wbWorkbook$add_style() wbWorkbook$to_df() wbWorkbook$load() wbWorkbook$save() wbWorkbook$open() wbWorkbook$buildTable() wbWorkbook$update_table() wbWorkbook$copy_cells() wbWorkbook$get_base_font() wbWorkbook$set_base_font() wbWorkbook$set_bookview() wbWorkbook$get_sheet_names() wbWorkbook$set_sheet_names() wbWorkbook$set_row_heights() wbWorkbook$remove_row_heights() wbWorkbook$createCols() wbWorkbook$group_cols() wbWorkbook$ungroup_cols() wbWorkbook$remove_col_widths() wbWorkbook$set_col_widths() wbWorkbook$group_rows() wbWorkbook$ungroup_rows() wbWorkbook$remove_worksheet() wbWorkbook$add_data_validation() wbWorkbook$merge_cells() wbWorkbook$unmerge_cells() wbWorkbook$freeze_pane() wbWorkbook$add_comment() wbWorkbook$remove_comment() wbWorkbook$add_thread() wbWorkbook$add_conditional_formatting() wbWorkbook$add_image() wbWorkbook$add_plot() wbWorkbook$add_drawing() wbWorkbook$add_chart_xml() wbWorkbook$add_mschart() wbWorkbook$add_form_control() wbWorkbook$print() wbWorkbook$protect() wbWorkbook$protect_worksheet() wbWorkbook$get_properties() wbWorkbook$set_properties() wbWorkbook$set_creators() wbWorkbook$add_creators() wbWorkbook$remove_creators() wbWorkbook$set_last_modified_by() wbWorkbook$page_setup() wbWorkbook$set_header_footer() wbWorkbook$get_tables() wbWorkbook$remove_tables() wbWorkbook$add_filter() wbWorkbook$remove_filter() wbWorkbook$set_grid_lines() wbWorkbook$grid_lines() wbWorkbook$add_named_region() wbWorkbook$get_named_regions() wbWorkbook$remove_named_region() wbWorkbook$set_order() wbWorkbook$get_sheet_visibility() wbWorkbook$set_sheet_visibility() wbWorkbook$add_page_break() wbWorkbook$clean_sheet() wbWorkbook$add_border() wbWorkbook$add_fill() wbWorkbook$add_font() wbWorkbook$add_numfmt() wbWorkbook$add_cell_style() wbWorkbook$get_cell_style() wbWorkbook$set_cell_style() wbWorkbook$add_named_style() wbWorkbook$add_dxfs_style() wbWorkbook$clone_sheet_style() wbWorkbook$add_sparklines() wbWorkbook$add_ignore_error() wbWorkbook$set_sheetview() wbWorkbook$add_person() wbWorkbook$get_person() wbWorkbook$get_active_sheet() wbWorkbook$set_active_sheet() wbWorkbook$get_selected() wbWorkbook$set_selected() wbWorkbook$clone()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"R6 class for a workbook — wbWorkbook","text":"Creates new wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$new( creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creator character vector creators. Duplicated ignored. title, subject, category, keywords, comments, manager, company workbook properties datetime_created datetime (POSIXt) workbook created. Defaults current Sys.time() workbook object created, Excel files saved. theme Optional theme identified string number ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-append-","dir":"Reference","previous_headings":"","what":"Method append()","title":"R6 class for a workbook — wbWorkbook","text":"Append field. method intended internal use","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$append(field, value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"field valid field name value value field","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-append-sheets-","dir":"Reference","previous_headings":"","what":"Method append_sheets()","title":"R6 class for a workbook — wbWorkbook","text":"Append self$workbook$sheets method intended internal use","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$append_sheets(value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"value value self$workbook$sheets","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-validate-sheet-","dir":"Reference","previous_headings":"","what":"Method validate_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"validate sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$validate_sheet(sheet)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-3","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet character sheet name integer location","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"integer position sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-chartsheet-","dir":"Reference","previous_headings":"","what":"Method add_chartsheet()","title":"R6 class for a workbook — wbWorkbook","text":"Add chart sheet workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_chartsheet( sheet = next_sheet(), tab_color = NULL, zoom = 100, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-4","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet tab_color tab_color zoom zoom visible visible ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-2","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-worksheet-","dir":"Reference","previous_headings":"","what":"Method add_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"Add worksheet wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_worksheet( sheet = next_sheet(), grid_lines = TRUE, row_col_headers = TRUE, tab_color = NULL, zoom = 100, header = NULL, footer = NULL, odd_header = header, odd_footer = footer, even_header = header, even_footer = footer, first_header = header, first_footer = footer, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), has_drawing = FALSE, paper_size = getOption(\"openxlsx2.paperSize\", default = 9), orientation = getOption(\"openxlsx2.orientation\", default = \"portrait\"), hdpi = getOption(\"openxlsx2.hdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), vdpi = getOption(\"openxlsx2.vdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-5","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet grid_lines gridLines row_col_headers rowColHeaders tab_color tabColor zoom zoom header header footer footer odd_header oddHeader odd_footer oddFooter even_header evenHeader even_footer evenFooter first_header firstHeader first_footer firstFooter visible visible has_drawing hasDrawing paper_size paperSize orientation orientation hdpi hdpi vdpi vdpi ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-3","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clone-worksheet-","dir":"Reference","previous_headings":"","what":"Method clone_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"Clone workbooksheet another workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-6","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clone_worksheet( old = current_sheet(), new = next_sheet(), from = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-6","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"old name worksheet clone new name new worksheet add name new worksheet add","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-data-","dir":"Reference","previous_headings":"","what":"Method add_data()","title":"R6 class for a workbook — wbWorkbook","text":"add data","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-7","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_data( sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, col_names = TRUE, row_names = FALSE, with_filter = FALSE, name = NULL, sep = \", \", apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-7","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet x x dims Cell range sheet start_col startCol start_row startRow array array col_names colNames row_names rowNames with_filter withFilter name name sep sep apply_cell_style applyCellStyle remove_cell_style writing existing cells, cell style removed? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments return wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-data-table-","dir":"Reference","previous_headings":"","what":"Method add_data_table()","title":"R6 class for a workbook — wbWorkbook","text":"add data table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-8","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_data_table( sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, col_names = TRUE, row_names = FALSE, table_style = \"TableStyleLight9\", table_name = NULL, with_filter = TRUE, sep = \", \", first_column = FALSE, last_column = FALSE, banded_rows = TRUE, banded_cols = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-8","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet x x dims Cell range sheet start_col startCol start_row startRow col_names colNames row_names rowNames table_style tableStyle table_name tableName with_filter withFilter sep sep first_column firstColumn last_column lastColumn banded_rows bandedRows banded_cols bandedCols apply_cell_style applyCellStyle remove_cell_style writing existing cells, cell style removed? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-4","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-pivot-table-","dir":"Reference","previous_headings":"","what":"Method add_pivot_table()","title":"R6 class for a workbook — wbWorkbook","text":"add pivot table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-9","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_pivot_table( x, sheet = next_sheet(), dims = \"A3\", filter, rows, cols, data, fun, params, pivot_table, slicer )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-9","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"x wb_data object sheet name sheet dims worksheet cell pivot table placed filter character object names used filter rows character object names used rows cols character object names used cols data character object names used data fun character object functions used data params list parameters modify pivot table creation pivot_table character object name pivot table slicer character object names used slicer","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"R6 class for a workbook — wbWorkbook","text":"fun can either AVERAGE, COUNT, COUNTA, MAX, MIN, PRODUCT, STDEV, STDEVP, SUM, VAR, VARP","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-5","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-slicer-","dir":"Reference","previous_headings":"","what":"Method add_slicer()","title":"R6 class for a workbook — wbWorkbook","text":"add pivot table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-10","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_slicer( x, dims = \"A1\", sheet = current_sheet(), pivot_table, slicer, params )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-10","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"x wb_data object dims worksheet cell pivot table placed sheet name sheet pivot_table name pivot table selected sheet slicer variable used slicer pivot table params list parameters modify pivot table creation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-6","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-formula-","dir":"Reference","previous_headings":"","what":"Method add_formula()","title":"R6 class for a workbook — wbWorkbook","text":"Add formula","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-11","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_formula( sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, cm = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-11","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet x x dims Cell range sheet start_col startCol start_row startRow array array cm cm apply_cell_style applyCellStyle remove_cell_style writing existing cells, cell style removed? ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-7","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-style-","dir":"Reference","previous_headings":"","what":"Method add_style()","title":"R6 class for a workbook — wbWorkbook","text":"add style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-12","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_style(style = NULL, style_name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-12","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"style style style_name style_name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-8","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-to-df-","dir":"Reference","previous_headings":"","what":"Method to_df()","title":"R6 class for a workbook — wbWorkbook","text":"to_df","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-13","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$to_df( sheet, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, skip_hidden_rows = FALSE, skip_hidden_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, na.strings = \"#N/A\", na.numbers = NA, fill_merged_cells = FALSE, dims, show_formula = FALSE, convert = TRUE, types, named_region, keep_attributes = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-13","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet Either sheet name index. missing first sheet workbook selected. start_row first row begin looking data. start_col first column begin looking data. row_names TRUE, first col data used row names. col_names TRUE, first row data used column names. skip_empty_rows TRUE, empty rows skipped. skip_empty_cols TRUE, empty columns skipped. skip_hidden_rows TRUE, hidden rows skipped. skip_hidden_cols TRUE, hidden columns skipped. rows numeric vector specifying rows Excel file read. NULL, rows read. cols numeric vector specifying columns Excel file read. NULL, columns read. detect_dates TRUE, attempt recognize dates perform conversion. na.strings character vector strings interpreted NA. Blank cells returned NA. na.numbers numeric vector digits interpreted NA. Blank cells returned NA. fill_merged_cells TRUE, value merged cell given cells within merge. dims Character string type \"A1:B2\" optional dimensions imported. show_formula TRUE, underlying Excel formulas shown. convert TRUE, conversion dates numerics attempted. types named numeric indicating, type data. 0: character, 1: numeric, 2: date, 3: posixt, 4:logical. Names must match returned data named_region Character string named_region (defined name table). sheet selected, first appearance selected. keep_attributes TRUE additional attributes returned. (used internally define cell type.) ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-9","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"data frame","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-load-","dir":"Reference","previous_headings":"","what":"Method load()","title":"R6 class for a workbook — wbWorkbook","text":"load workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-14","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$load(file, sheet, data_only = FALSE, calc_chain = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-14","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"file file sheet name sheet data_only data_only calc_chain calc_chain ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-10","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-save-","dir":"Reference","previous_headings":"","what":"Method save()","title":"R6 class for a workbook — wbWorkbook","text":"Save workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-15","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$save(file = self$path, overwrite = TRUE, path = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-15","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"file path save workbook overwrite FALSE, overwrite path exists path Deprecated argument previously used file. Please use file new code.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-11","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-open-","dir":"Reference","previous_headings":"","what":"Method open()","title":"R6 class for a workbook — wbWorkbook","text":"open wbWorkbook Excel.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-16","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$open(interactive = NA)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-16","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"interactive FALSE throw warning open path. can manually set TRUE, otherwise NA (default) uses value returned base::interactive()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"details-1","dir":"Reference","previous_headings":"","what":"Details","title":"R6 class for a workbook — wbWorkbook","text":"minor helper wrapping xl_open entire thing","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-12","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-buildtable-","dir":"Reference","previous_headings":"","what":"Method buildTable()","title":"R6 class for a workbook — wbWorkbook","text":"Build table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-17","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$buildTable( sheet = current_sheet(), colNames, ref, showColNames, tableStyle, tableName, withFilter, totalsRowCount = 0, showFirstColumn = 0, showLastColumn = 0, showRowStripes = 1, showColumnStripes = 0 )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-17","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet colNames colNames ref ref showColNames showColNames tableStyle tableStyle tableName tableName withFilter withFilter totalsRowCount totalsRowCount showFirstColumn showFirstColumn showLastColumn showLastColumn showRowStripes showRowStripes showColumnStripes showColumnStripes","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-13","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheet object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-update-table-","dir":"Reference","previous_headings":"","what":"Method update_table()","title":"R6 class for a workbook — wbWorkbook","text":"update data_table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-18","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$update_table(sheet = current_sheet(), dims = \"A1\", tabname)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-18","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet tabname tablename","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-14","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheet object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-copy-cells-","dir":"Reference","previous_headings":"","what":"Method copy_cells()","title":"R6 class for a workbook — wbWorkbook","text":"copy cells around workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-19","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$copy_cells( sheet = current_sheet(), dims = \"A1\", data, as_value = FALSE, as_ref = FALSE, transpose = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-19","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet data wb_data object as_value copy value written as_ref references cell written transpose data written transposed ... additional arguments passed add_data() used as_value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-15","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheet object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-base-font-","dir":"Reference","previous_headings":"","what":"Method get_base_font()","title":"R6 class for a workbook — wbWorkbook","text":"Get base font","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-20","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_base_font()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-16","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"list font","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-base-font-","dir":"Reference","previous_headings":"","what":"Method set_base_font()","title":"R6 class for a workbook — wbWorkbook","text":"Set base font","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-21","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_base_font( font_size = 11, font_color = wb_color(theme = \"1\"), font_name = \"Calibri\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-20","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"font_size fontSize font_color font_color font_name font_name ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-17","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-bookview-","dir":"Reference","previous_headings":"","what":"Method set_bookview()","title":"R6 class for a workbook — wbWorkbook","text":"Set book views","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-22","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_bookview( active_tab = NULL, auto_filter_date_grouping = NULL, first_sheet = NULL, minimized = NULL, show_horizontal_scroll = NULL, show_sheet_tabs = NULL, show_vertical_scroll = NULL, tab_ratio = NULL, visibility = NULL, window_height = NULL, window_width = NULL, x_window = NULL, y_window = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-21","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"active_tab activeTab auto_filter_date_grouping autoFilterDateGrouping first_sheet firstSheet minimized minimized show_horizontal_scroll showHorizontalScroll show_sheet_tabs showSheetTabs show_vertical_scroll showVerticalScroll tab_ratio tabRatio visibility visibility window_height windowHeight window_width windowWidth x_window xWindow y_window yWindow ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-18","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-sheet-names-","dir":"Reference","previous_headings":"","what":"Method get_sheet_names()","title":"R6 class for a workbook — wbWorkbook","text":"Get sheet names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-23","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_sheet_names(escape = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-22","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"escape Logical xml special characters escaped","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-19","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"named character vector sheet names order. names represent original value worksheet prior character substitutions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-sheet-names-","dir":"Reference","previous_headings":"","what":"Method set_sheet_names()","title":"R6 class for a workbook — wbWorkbook","text":"Sets sheet name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-24","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_sheet_names(old = NULL, new)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-23","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"old Old sheet name new New sheet name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-20","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-row-heights-","dir":"Reference","previous_headings":"","what":"Method set_row_heights()","title":"R6 class for a workbook — wbWorkbook","text":"Sets row height sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-25","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_row_heights( sheet = current_sheet(), rows, heights = NULL, hidden = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-24","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows heights heights hidden hidden","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-21","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-row-heights-","dir":"Reference","previous_headings":"","what":"Method remove_row_heights()","title":"R6 class for a workbook — wbWorkbook","text":"Removes row height sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-26","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_row_heights(sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-25","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-22","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-createcols-","dir":"Reference","previous_headings":"","what":"Method createCols()","title":"R6 class for a workbook — wbWorkbook","text":"creates column object worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-27","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$createCols(sheet = current_sheet(), n, beg, end)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-26","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet n n beg beg end end","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-group-cols-","dir":"Reference","previous_headings":"","what":"Method group_cols()","title":"R6 class for a workbook — wbWorkbook","text":"Group cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-28","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$group_cols( sheet = current_sheet(), cols, collapsed = FALSE, levels = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-27","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet cols cols collapsed collapsed levels levels","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-23","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-ungroup-cols-","dir":"Reference","previous_headings":"","what":"Method ungroup_cols()","title":"R6 class for a workbook — wbWorkbook","text":"ungroup cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-29","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$ungroup_cols(sheet = current_sheet(), cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-28","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet cols columns","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-24","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-col-widths-","dir":"Reference","previous_headings":"","what":"Method remove_col_widths()","title":"R6 class for a workbook — wbWorkbook","text":"Remove row heights worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-30","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_col_widths(sheet = current_sheet(), cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-29","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name index worksheet cols Indices columns remove custom width () .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-25","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-col-widths-","dir":"Reference","previous_headings":"","what":"Method set_col_widths()","title":"R6 class for a workbook — wbWorkbook","text":"Set column widths","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-31","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_col_widths( sheet = current_sheet(), cols, widths = 8.43, hidden = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-30","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet cols cols widths Width columns hidden logical vector determine cols hidden; values repeated across length cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-26","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-group-rows-","dir":"Reference","previous_headings":"","what":"Method group_rows()","title":"R6 class for a workbook — wbWorkbook","text":"Group rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-32","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$group_rows( sheet = current_sheet(), rows, collapsed = FALSE, levels = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-31","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows collapsed collapsed levels levels","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-27","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-ungroup-rows-","dir":"Reference","previous_headings":"","what":"Method ungroup_rows()","title":"R6 class for a workbook — wbWorkbook","text":"ungroup rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-33","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$ungroup_rows(sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-32","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-28","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-worksheet-","dir":"Reference","previous_headings":"","what":"Method remove_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"Remove worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-34","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_worksheet(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-33","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet worksheet delete","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-29","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-data-validation-","dir":"Reference","previous_headings":"","what":"Method add_data_validation()","title":"R6 class for a workbook — wbWorkbook","text":"Adds data validation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-35","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_data_validation( sheet = current_sheet(), dims = \"A1\", type, operator, value, allow_blank = TRUE, show_input_msg = TRUE, show_error_msg = TRUE, error_style = NULL, error_title = NULL, error = NULL, prompt_title = NULL, prompt = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-34","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet type type operator operator value value allow_blank allowBlank show_input_msg showInputMsg show_error_msg showErrorMsg error_style icon shown options deal inputs. Default \"stop\" (cancel), else \"information\" (prompt popup) \"warning\" (prompt accept change input) error_title error title error error text prompt_title prompt title prompt prompt text ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-30","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-merge-cells-","dir":"Reference","previous_headings":"","what":"Method merge_cells()","title":"R6 class for a workbook — wbWorkbook","text":"Set cell merging sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-36","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$merge_cells( sheet = current_sheet(), dims = NULL, solve = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-35","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet solve logical intersecting cells solved ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-31","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-unmerge-cells-","dir":"Reference","previous_headings":"","what":"Method unmerge_cells()","title":"R6 class for a workbook — wbWorkbook","text":"Removes cell merging sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-37","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$unmerge_cells(sheet = current_sheet(), dims = NULL, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-36","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-32","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-freeze-pane-","dir":"Reference","previous_headings":"","what":"Method freeze_pane()","title":"R6 class for a workbook — wbWorkbook","text":"Set freeze panes sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-38","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$freeze_pane( sheet = current_sheet(), first_active_row = NULL, first_active_col = NULL, first_row = FALSE, first_col = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-37","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet first_active_row first_active_row first_active_col first_active_col first_row first_row first_col first_col ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-33","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-comment-","dir":"Reference","previous_headings":"","what":"Method add_comment()","title":"R6 class for a workbook — wbWorkbook","text":"Add comment","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-39","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_comment(sheet = current_sheet(), dims = \"A1\", comment, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-38","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims row column spreadsheet dimension, e.g. \"A1\" comment comment apply worksheet ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-34","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-comment-","dir":"Reference","previous_headings":"","what":"Method remove_comment()","title":"R6 class for a workbook — wbWorkbook","text":"Remove comment","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-40","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_comment(sheet = current_sheet(), dims = \"A1\", ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-39","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims row column spreadsheet dimension, e.g. \"A1\" ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-35","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-thread-","dir":"Reference","previous_headings":"","what":"Method add_thread()","title":"R6 class for a workbook — wbWorkbook","text":"add threaded comment worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-41","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_thread( sheet = current_sheet(), dims = \"A1\", comment = NULL, person_id, reply = FALSE, resolve = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-40","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet comment comment add person_id person Id added reply logical comment reply resolve logical comment marked resolved","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-conditional-formatting-","dir":"Reference","previous_headings":"","what":"Method add_conditional_formatting()","title":"R6 class for a workbook — wbWorkbook","text":"Add conditional formatting","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-42","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_conditional_formatting( sheet = current_sheet(), dims = NULL, rule = NULL, style = NULL, type = c(\"expression\", \"colorScale\", \"dataBar\", \"iconSet\", \"duplicatedValues\", \"uniqueValues\", \"containsErrors\", \"notContainsErrors\", \"containsBlanks\", \"notContainsBlanks\", \"containsText\", \"notContainsText\", \"beginsWith\", \"endsWith\", \"between\", \"topN\", \"bottomN\"), params = list(showValue = TRUE, gradient = TRUE, border = TRUE, percent = FALSE, rank = 5L), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-41","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet rule rule style style type type params Additional parameters ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-36","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-image-","dir":"Reference","previous_headings":"","what":"Method add_image()","title":"R6 class for a workbook — wbWorkbook","text":"Insert image sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-43","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_image( sheet = current_sheet(), dims = \"A1\", file, width = 6, height = 3, row_offset = 0, col_offset = 0, units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-42","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet file file width width height height row_offset, col_offset offsets units units dpi dpi ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-37","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-plot-","dir":"Reference","previous_headings":"","what":"Method add_plot()","title":"R6 class for a workbook — wbWorkbook","text":"Add plot. wrapper add_image()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-44","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_plot( sheet = current_sheet(), dims = \"A1\", width = 6, height = 4, row_offset = 0, col_offset = 0, file_type = \"png\", units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-43","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet width width height height row_offset, col_offset offsets file_type fileType units units dpi dpi ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-38","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-drawing-","dir":"Reference","previous_headings":"","what":"Method add_drawing()","title":"R6 class for a workbook — wbWorkbook","text":"Add xml drawing","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-45","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_drawing( sheet = current_sheet(), dims = \"A1\", xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-44","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet xml xml col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-39","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-chart-xml-","dir":"Reference","previous_headings":"","what":"Method add_chart_xml()","title":"R6 class for a workbook — wbWorkbook","text":"Add xml chart","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-46","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_chart_xml( sheet = current_sheet(), dims = NULL, xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-45","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet xml xml col_offset, row_offset positioning parameters ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-40","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-mschart-","dir":"Reference","previous_headings":"","what":"Method add_mschart()","title":"R6 class for a workbook — wbWorkbook","text":"Add mschart chart workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-47","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_mschart( sheet = current_sheet(), dims = NULL, graph, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-46","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims dimensions sheet appear graph mschart graph col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-41","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-form-control-","dir":"Reference","previous_headings":"","what":"Method add_form_control()","title":"R6 class for a workbook — wbWorkbook","text":"Add form control workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-48","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_form_control( sheet = current_sheet(), dims = \"A1\", type = c(\"Checkbox\", \"Radio\", \"Drop\"), text = NULL, link = NULL, range = NULL, checked = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-47","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet type type text text link link range range checked checked","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-42","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-print-","dir":"Reference","previous_headings":"","what":"Method print()","title":"R6 class for a workbook — wbWorkbook","text":"Prints wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-49","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$print()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-43","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly; called side-effects","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-protect-","dir":"Reference","previous_headings":"","what":"Method protect()","title":"R6 class for a workbook — wbWorkbook","text":"Protect workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-50","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$protect( protect = TRUE, password = NULL, lock_structure = FALSE, lock_windows = FALSE, type = 1, file_sharing = FALSE, username = unname(Sys.info()[\"user\"]), read_only_recommended = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-48","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"protect protect password password lock_structure lock_structure lock_windows lock_windows type type file_sharing file_sharing username username read_only_recommended read_only_recommended ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-44","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-protect-worksheet-","dir":"Reference","previous_headings":"","what":"Method protect_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"protect worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-51","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$protect_worksheet( sheet = current_sheet(), protect = TRUE, password = NULL, properties = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-49","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet protect protect password password properties character vector properties lock. Can one following: \"selectLockedCells\", \"selectUnlockedCells\", \"formatCells\", \"formatColumns\", \"formatRows\", \"insertColumns\", \"insertRows\", \"insertHyperlinks\", \"deleteColumns\", \"deleteRows\", \"sort\", \"autoFilter\", \"pivotTables\", \"objects\", \"scenarios\"","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-45","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-properties-","dir":"Reference","previous_headings":"","what":"Method get_properties()","title":"R6 class for a workbook — wbWorkbook","text":"Get properties workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-52","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_properties()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-properties-","dir":"Reference","previous_headings":"","what":"Method set_properties()","title":"R6 class for a workbook — wbWorkbook","text":"Set property workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-53","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_properties( creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), modifier = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-50","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creator character vector creators. Duplicated ignored. title, subject, category, datetime_created, modifier, keywords, comments, manager, company workbook property set","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-creators-","dir":"Reference","previous_headings":"","what":"Method set_creators()","title":"R6 class for a workbook — wbWorkbook","text":"Set creator(s)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-54","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_creators(creators)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-51","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creators character vector creators set. Duplicates ignored.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-creators-","dir":"Reference","previous_headings":"","what":"Method add_creators()","title":"R6 class for a workbook — wbWorkbook","text":"Add creator(s)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-55","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_creators(creators)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-52","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creators character vector creators add. Duplicates ignored.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-creators-","dir":"Reference","previous_headings":"","what":"Method remove_creators()","title":"R6 class for a workbook — wbWorkbook","text":"Remove creator(s)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-56","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_creators(creators)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-53","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creators character vector creators remove. duplicated removed.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-last-modified-by-","dir":"Reference","previous_headings":"","what":"Method set_last_modified_by()","title":"R6 class for a workbook — wbWorkbook","text":"Change last modified ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-57","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_last_modified_by(name, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-54","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name new value ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-46","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-page-setup-","dir":"Reference","previous_headings":"","what":"Method page_setup()","title":"R6 class for a workbook — wbWorkbook","text":"page_setup()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-58","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$page_setup( sheet = current_sheet(), orientation = NULL, scale = 100, left = 0.7, right = 0.7, top = 0.75, bottom = 0.75, header = 0.3, footer = 0.3, fit_to_width = FALSE, fit_to_height = FALSE, paper_size = NULL, print_title_rows = NULL, print_title_cols = NULL, summary_row = NULL, summary_col = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-55","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet orientation orientation scale scale left left right right top top bottom bottom header header footer footer fit_to_width fitToWidth fit_to_height fitToHeight paper_size paperSize print_title_rows printTitleRows print_title_cols printTitleCols summary_row summaryRow summary_col summaryCol ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-47","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-header-footer-","dir":"Reference","previous_headings":"","what":"Method set_header_footer()","title":"R6 class for a workbook — wbWorkbook","text":"Sets headers footers","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-59","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_header_footer( sheet = current_sheet(), header = NULL, footer = NULL, even_header = NULL, even_footer = NULL, first_header = NULL, first_footer = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-56","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet header header footer footer even_header evenHeader even_footer evenFooter first_header firstHeader first_footer firstFooter ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-48","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-tables-","dir":"Reference","previous_headings":"","what":"Method get_tables()","title":"R6 class for a workbook — wbWorkbook","text":"get tables","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-60","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_tables(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-57","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-49","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"sheet tables. character() empty","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-tables-","dir":"Reference","previous_headings":"","what":"Method remove_tables()","title":"R6 class for a workbook — wbWorkbook","text":"remove tables","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-61","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_tables(sheet = current_sheet(), table, remove_data = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-58","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet table table remove_data removes data well","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-50","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-filter-","dir":"Reference","previous_headings":"","what":"Method add_filter()","title":"R6 class for a workbook — wbWorkbook","text":"add filters","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-62","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_filter(sheet = current_sheet(), rows, cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-59","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows cols cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-51","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-filter-","dir":"Reference","previous_headings":"","what":"Method remove_filter()","title":"R6 class for a workbook — wbWorkbook","text":"remove filters","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-63","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_filter(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-60","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-52","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-grid-lines-","dir":"Reference","previous_headings":"","what":"Method set_grid_lines()","title":"R6 class for a workbook — wbWorkbook","text":"grid lines","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-64","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_grid_lines(sheet = current_sheet(), show = FALSE, print = show)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-61","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet show show print print","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-53","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-grid-lines-","dir":"Reference","previous_headings":"","what":"Method grid_lines()","title":"R6 class for a workbook — wbWorkbook","text":"grid lines","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-65","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$grid_lines(sheet = current_sheet(), show = FALSE, print = show)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-62","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet show show print print","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-54","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-named-region-","dir":"Reference","previous_headings":"","what":"Method add_named_region()","title":"R6 class for a workbook — wbWorkbook","text":"add named region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-66","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_named_region( sheet = current_sheet(), dims = \"A1\", name, local_sheet = FALSE, overwrite = FALSE, comment = NULL, hidden = NULL, custom_menu = NULL, description = NULL, is_function = NULL, function_group_id = NULL, help = NULL, local_name = NULL, publish_to_server = NULL, status_bar = NULL, vb_procedure = NULL, workbook_parameter = NULL, xml = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-63","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet name name local_sheet local_sheet overwrite overwrite comment comment hidden hidden custom_menu custom_menu description description is_function function function_group_id function group id help help local_name localName publish_to_server publish server status_bar status bar vb_procedure vb procedure workbook_parameter workbookParameter xml xml ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-55","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-named-regions-","dir":"Reference","previous_headings":"","what":"Method get_named_regions()","title":"R6 class for a workbook — wbWorkbook","text":"get named regions workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-67","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_named_regions(tables = FALSE, x = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-64","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"tables Return tables well? x used.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-56","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"data.frame named regions","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-named-region-","dir":"Reference","previous_headings":"","what":"Method remove_named_region()","title":"R6 class for a workbook — wbWorkbook","text":"remove named region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-68","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_named_region(sheet = current_sheet(), name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-65","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet name name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-57","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-order-","dir":"Reference","previous_headings":"","what":"Method set_order()","title":"R6 class for a workbook — wbWorkbook","text":"set worksheet order","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-69","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_order(sheets)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-66","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheets sheets","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-58","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-sheet-visibility-","dir":"Reference","previous_headings":"","what":"Method get_sheet_visibility()","title":"R6 class for a workbook — wbWorkbook","text":"Get sheet visibility","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-70","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_sheet_visibility()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-59","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"Returns sheet visibility","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-sheet-visibility-","dir":"Reference","previous_headings":"","what":"Method set_sheet_visibility()","title":"R6 class for a workbook — wbWorkbook","text":"Set sheet visibility","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-71","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_sheet_visibility(sheet = current_sheet(), value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-67","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet value value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-60","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-page-break-","dir":"Reference","previous_headings":"","what":"Method add_page_break()","title":"R6 class for a workbook — wbWorkbook","text":"Add page break","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-72","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_page_break(sheet = current_sheet(), row = NULL, col = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-68","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet row row col col","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-61","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clean-sheet-","dir":"Reference","previous_headings":"","what":"Method clean_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"clean sheet (remove values)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-73","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clean_sheet( sheet = current_sheet(), dims = NULL, numbers = TRUE, characters = TRUE, styles = TRUE, merged_cells = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-69","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet numbers remove numbers characters remove characters styles remove styles merged_cells remove merged_cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-62","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-border-","dir":"Reference","previous_headings":"","what":"Method add_border()","title":"R6 class for a workbook — wbWorkbook","text":"create borders cell region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-74","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_border( sheet = current_sheet(), dims = \"A1\", bottom_color = wb_color(hex = \"FF000000\"), left_color = wb_color(hex = \"FF000000\"), right_color = wb_color(hex = \"FF000000\"), top_color = wb_color(hex = \"FF000000\"), bottom_border = \"thin\", left_border = \"thin\", right_border = \"thin\", top_border = \"thin\", inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, inner_vcolor = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-70","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims dimensions worksheet e.g. \"A1\", \"A1:A5\", \"A1:H5\" bottom_color, left_color, right_color, top_color, inner_hcolor, inner_vcolor color, either something openxml knows RGB color left_border, right_border, top_border, bottom_border, inner_hgrid, inner_vgrid border style, NULL border drawn. See create_border possible border styles ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-63","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-fill-","dir":"Reference","previous_headings":"","what":"Method add_fill()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple fill function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-75","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_fill( sheet = current_sheet(), dims = \"A1\", color = wb_color(hex = \"FFFFFF00\"), pattern = \"solid\", gradient_fill = \"\", every_nth_col = 1, every_nth_row = 1, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-71","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet color colors apply, e.g. yellow: wb_color(hex = \"FFFFFF00\") pattern various default \"none\" others possible: \"solid\", \"mediumGray\", \"darkGray\", \"lightGray\", \"darkHorizontal\", \"darkVertical\", \"darkDown\", \"darkUp\", \"darkGrid\", \"darkTrellis\", \"lightHorizontal\", \"lightVertical\", \"lightDown\", \"lightUp\", \"lightGrid\", \"lightTrellis\", \"gray125\", \"gray0625\" gradient_fill gradient fill xml pattern. every_nth_col col filled every_nth_row row filled ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-64","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-font-","dir":"Reference","previous_headings":"","what":"Method add_font()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple font function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-76","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_font( sheet = current_sheet(), dims = \"A1\", name = \"Calibri\", color = wb_color(hex = \"FF000000\"), size = \"11\", bold = \"\", italic = \"\", outline = \"\", strike = \"\", underline = \"\", charset = \"\", condense = \"\", extend = \"\", family = \"\", scheme = \"\", shadow = \"\", vert_align = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-72","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet name font name: default \"Calibri\" color rgb color: default \"FF000000\" size font size: default \"11\", bold bold italic italic outline outline strike strike underline underline charset charset condense condense extend extend family font family scheme font scheme shadow shadow vert_align vertical alignment ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-65","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-numfmt-","dir":"Reference","previous_headings":"","what":"Method add_numfmt()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple number format function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-77","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_numfmt(sheet = current_sheet(), dims = \"A1\", numfmt)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-73","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet numfmt number format id character format","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-66","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-cell-style-","dir":"Reference","previous_headings":"","what":"Method add_cell_style()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple cell style format function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-78","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_cell_style( sheet = current_sheet(), dims = \"A1\", apply_alignment = NULL, apply_border = NULL, apply_fill = NULL, apply_font = NULL, apply_number_format = NULL, apply_protection = NULL, border_id = NULL, ext_lst = NULL, fill_id = NULL, font_id = NULL, hidden = NULL, horizontal = NULL, indent = NULL, justify_last_line = NULL, locked = NULL, num_fmt_id = NULL, pivot_button = NULL, quote_prefix = NULL, reading_order = NULL, relative_indent = NULL, shrink_to_fit = NULL, text_rotation = NULL, vertical = NULL, wrap_text = NULL, xf_id = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-74","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet apply_alignment logical apply alignment apply_border logical apply border apply_fill logical apply fill apply_font logical apply font apply_number_format logical apply number format apply_protection logical apply protection border_id border ID apply ext_lst extension list something like ...<\/extLst> fill_id fill ID apply font_id font ID apply hidden logical cell hidden horizontal align content horizontal ('left', 'center', 'right') indent logical indent content justify_last_line logical justify last line locked logical cell locked num_fmt_id number format ID apply pivot_button unknown quote_prefix unknown reading_order reading order left right relative_indent relative indentation shrink_to_fit logical shrink fit text_rotation degrees text rotation vertical vertical alignment content ('top', 'center', 'bottom') wrap_text wrap text cell xf_id xf ID apply ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-67","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-cell-style-","dir":"Reference","previous_headings":"","what":"Method get_cell_style()","title":"R6 class for a workbook — wbWorkbook","text":"get sheet style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-79","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_cell_style(sheet = current_sheet(), dims)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-75","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-68","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"character vector cell styles","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-cell-style-","dir":"Reference","previous_headings":"","what":"Method set_cell_style()","title":"R6 class for a workbook — wbWorkbook","text":"set sheet style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-80","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_cell_style(sheet = current_sheet(), dims, style)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-76","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet style style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-69","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-named-style-","dir":"Reference","previous_headings":"","what":"Method add_named_style()","title":"R6 class for a workbook — wbWorkbook","text":"set sheet style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-81","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_named_style( sheet = current_sheet(), dims = \"A1\", name = \"Normal\", font_name = NULL, font_size = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-77","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet name name font_name, font_size optional else default theme","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-70","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-dxfs-style-","dir":"Reference","previous_headings":"","what":"Method add_dxfs_style()","title":"R6 class for a workbook — wbWorkbook","text":"create dxfs style styles used conditional formatting custom table styles","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-82","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_dxfs_style( name, font_name = NULL, font_size = NULL, font_color = NULL, num_fmt = NULL, border = NULL, border_color = wb_color(getOption(\"openxlsx2.borderColor\", \"black\")), border_style = getOption(\"openxlsx2.borderStyle\", \"thin\"), bg_fill = NULL, gradient_fill = NULL, text_bold = NULL, text_italic = NULL, text_underline = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-78","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name style name font_name font name font_size font size font_color font color (wb_color() object) num_fmt number format border logical borders applied border_color border color border_style border style bg_fill background fill gradient_fill gradient fill text_bold logical text bold text_italic logical text italic text_underline logical text underlined ... additional arguments passed create_dxfs_style()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-71","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clone-sheet-style-","dir":"Reference","previous_headings":"","what":"Method clone_sheet_style()","title":"R6 class for a workbook — wbWorkbook","text":"clone style one sheet another","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-83","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clone_sheet_style(from = current_sheet(), to)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-79","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"worksheet cloning worksheet style applied ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-sparklines-","dir":"Reference","previous_headings":"","what":"Method add_sparklines()","title":"R6 class for a workbook — wbWorkbook","text":"apply sparkline worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-84","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_sparklines(sheet = current_sheet(), sparklines)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-80","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet sparklines sparkline created create_sparkline()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-ignore-error-","dir":"Reference","previous_headings":"","what":"Method add_ignore_error()","title":"R6 class for a workbook — wbWorkbook","text":"Ignore error worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-85","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_ignore_error( sheet = current_sheet(), dims = \"A1\", calculated_column = FALSE, empty_cell_reference = FALSE, eval_error = FALSE, formula = FALSE, formula_range = FALSE, list_data_validation = FALSE, number_stored_as_text = FALSE, two_digit_text_year = FALSE, unlocked_formula = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-81","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet calculated_column calculatedColumn empty_cell_reference emptyCellReference eval_error evalError formula formula formula_range formulaRange list_data_validation listDataValidation number_stored_as_text numberStoredAsText two_digit_text_year twoDigitTextYear unlocked_formula unlockedFormula ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-sheetview-","dir":"Reference","previous_headings":"","what":"Method set_sheetview()","title":"R6 class for a workbook — wbWorkbook","text":"add sheetview","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-86","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_sheetview( sheet = current_sheet(), color_id = NULL, default_grid_color = NULL, right_to_left = NULL, show_formulas = NULL, show_grid_lines = NULL, show_outline_symbols = NULL, show_row_col_headers = NULL, show_ruler = NULL, show_white_space = NULL, show_zeros = NULL, tab_selected = NULL, top_left_cell = NULL, view = NULL, window_protection = NULL, workbook_view_id = NULL, zoom_scale = NULL, zoom_scale_normal = NULL, zoom_scale_page_layout_view = NULL, zoom_scale_sheet_layout_view = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-82","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet color_id, default_grid_color Integer: color, default 64 right_to_left Logical: TRUE column ordering right left show_formulas Logical: TRUE cell formulas shown show_grid_lines Logical: TRUE worksheet grid shown show_outline_symbols Logical: TRUE outline symbols shown show_row_col_headers Logical: TRUE row column headers shown show_ruler Logical: TRUE ruler shown page layout view show_white_space Logical: TRUE margins shown page layout view show_zeros Logical: FALSE cells containing zero shown blank !showFormulas tab_selected Integer: zero vector indicating selected tab top_left_cell Cell: cell shown top left corner / top right rightToLeft view View: \"normal\", \"pageBreakPreview\" \"pageLayout\" window_protection Logical: TRUE panes protected workbook_view_id integer: Pointing view inside workbook zoom_scale, zoom_scale_normal, zoom_scale_page_layout_view, zoom_scale_sheet_layout_view Integer: zoom scale 10 400. values current, normal etc. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-72","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-person-","dir":"Reference","previous_headings":"","what":"Method add_person()","title":"R6 class for a workbook — wbWorkbook","text":"add person workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-87","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_person( name = NULL, id = NULL, user_id = NULL, provider_id = \"None\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-83","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name name id id user_id user_id provider_id provider_id","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-person-","dir":"Reference","previous_headings":"","what":"Method get_person()","title":"R6 class for a workbook — wbWorkbook","text":"description get person","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-88","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_person(name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-84","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-active-sheet-","dir":"Reference","previous_headings":"","what":"Method get_active_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"description get active sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-89","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_active_sheet()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-active-sheet-","dir":"Reference","previous_headings":"","what":"Method set_active_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"description set active sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-90","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_active_sheet(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-85","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-selected-","dir":"Reference","previous_headings":"","what":"Method get_selected()","title":"R6 class for a workbook — wbWorkbook","text":"description get selected sheets","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-91","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_selected()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-selected-","dir":"Reference","previous_headings":"","what":"Method set_selected()","title":"R6 class for a workbook — wbWorkbook","text":"set selected sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-92","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_selected(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-86","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"R6 class for a workbook — wbWorkbook","text":"objects class cloneable method.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-93","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clone(deep = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-87","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"deep Whether make deep clone.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify borders in a cell region of a worksheet — wb_add_border","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"wb wrapper create borders cell regions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"","code":"wb_add_border( wb, sheet = current_sheet(), dims = \"A1\", bottom_color = wb_color(hex = \"FF000000\"), left_color = wb_color(hex = \"FF000000\"), right_color = wb_color(hex = \"FF000000\"), top_color = wb_color(hex = \"FF000000\"), bottom_border = \"thin\", left_border = \"thin\", right_border = \"thin\", top_border = \"thin\", inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, inner_vcolor = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"wb wbWorkbook sheet worksheet dims Cell range worksheet e.g. \"A1\", \"A1:A5\", \"A1:H5\" bottom_color, left_color, right_color, top_color, inner_hcolor, inner_vcolor color, either something openxml knows RGB color left_border, right_border, top_border, bottom_border, inner_hgrid, inner_vgrid border style, NULL border drawn. See create_border() possible border styles ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb <- wb_add_border(wb, 1, dims = \"A1:K1\", left_border = NULL, right_border = NULL, top_border = NULL, bottom_border = \"double\") wb <- wb_add_border(wb, 1, dims = \"A5\", left_border = \"dotted\", right_border = \"dotted\", top_border = \"hair\", bottom_border = \"thick\") wb <- wb_add_border(wb, 1, dims = \"C2:C5\") wb <- wb_add_border(wb, 1, dims = \"G2:H3\") wb <- wb_add_border(wb, 1, dims = \"G12:H13\", left_color = wb_color(hex = \"FF9400D3\"), right_color = wb_color(hex = \"FF4B0082\"), top_color = wb_color(hex = \"FF0000FF\"), bottom_color = wb_color(hex = \"FF00FF00\")) wb <- wb_add_border(wb, 1, dims = \"A20:C23\") wb <- wb_add_border(wb, 1, dims = \"B12:D14\", left_color = wb_color(hex = \"FFFFFF00\"), right_color = wb_color(hex = \"FFFF7F00\"), bottom_color = wb_color(hex = \"FFFF0000\")) wb <- wb_add_border(wb, 1, dims = \"D28:E28\") # With chaining wb <- wb_workbook() wb$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_border(1, dims = \"A1:K1\", left_border = NULL, right_border = NULL, top_border = NULL, bottom_border = \"double\") wb$add_border(1, dims = \"A5\", left_border = \"dotted\", right_border = \"dotted\", top_border = \"hair\", bottom_border = \"thick\") wb$add_border(1, dims = \"C2:C5\") wb$add_border(1, dims = \"G2:H3\") wb$add_border(1, dims = \"G12:H13\", left_color = wb_color(hex = \"FF9400D3\"), right_color = wb_color(hex = \"FF4B0082\"), top_color = wb_color(hex = \"FF0000FF\"), bottom_color = wb_color(hex = \"FF00FF00\")) wb$add_border(1, dims = \"A20:C23\") wb$add_border(1, dims = \"B12:D14\", left_color = wb_color(hex = \"FFFFFF00\"), right_color = wb_color(hex = \"FFFF7F00\"), bottom_color = wb_color(hex = \"FFFF0000\")) wb$add_border(1, dims = \"D28:E28\") # if (interactive()) wb$open() wb <- wb_workbook() wb$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_border(1, dims = \"A2:K33\", inner_vgrid = \"thin\", inner_vcolor = c(rgb=\"FF808080\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the style in a cell region — wb_add_cell_style","title":"Modify the style in a cell region — wb_add_cell_style","text":"Add cell style cell region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the style in a cell region — wb_add_cell_style","text":"","code":"wb_add_cell_style( wb, sheet = current_sheet(), dims = \"A1\", apply_alignment = NULL, apply_border = NULL, apply_fill = NULL, apply_font = NULL, apply_number_format = NULL, apply_protection = NULL, border_id = NULL, ext_lst = NULL, fill_id = NULL, font_id = NULL, hidden = NULL, horizontal = NULL, indent = NULL, justify_last_line = NULL, locked = NULL, num_fmt_id = NULL, pivot_button = NULL, quote_prefix = NULL, reading_order = NULL, relative_indent = NULL, shrink_to_fit = NULL, text_rotation = NULL, vertical = NULL, wrap_text = NULL, xf_id = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the style in a cell region — wb_add_cell_style","text":"wb workbook sheet worksheet dims cell range apply_alignment logical apply alignment apply_border logical apply border apply_fill logical apply fill apply_font logical apply font apply_number_format logical apply number format apply_protection logical apply protection border_id border ID apply ext_lst extension list something like ...<\/extLst> fill_id fill ID apply font_id font ID apply hidden logical cell hidden horizontal align content horizontal ('left', 'center', 'right') indent logical indent content justify_last_line logical justify last line locked logical cell locked num_fmt_id number format ID apply pivot_button unknown quote_prefix unknown reading_order reading order left right relative_indent relative indentation shrink_to_fit logical shrink fit text_rotation degrees text rotation vertical vertical alignment content ('top', 'center', 'bottom') wrap_text wrap text cell xf_id xf ID apply ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the style in a cell region — wb_add_cell_style","text":"wbWorkbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the style in a cell region — wb_add_cell_style","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", x = mtcars) wb %>% wb_add_cell_style( dims = \"A1:K1\", text_rotation = \"45\", horizontal = \"center\", vertical = \"center\", wrap_text = \"1\" ) # Chaining wb <- wb_workbook()$add_worksheet(\"S1\")$add_data(x = mtcars) wb$add_cell_style(dims = \"A1:K1\", text_rotation = \"45\", horizontal = \"center\", vertical = \"center\", wrap_text = \"1\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chart_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a chart XML to a worksheet — wb_add_chart_xml","title":"Add a chart XML to a worksheet — wb_add_chart_xml","text":"Add chart XML worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chart_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a chart XML to a worksheet — wb_add_chart_xml","text":"","code":"wb_add_chart_xml( wb, sheet = current_sheet(), dims = NULL, xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chart_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a chart XML to a worksheet — wb_add_chart_xml","text":"wb workbook sheet sheet graph appear dims dimensions sheet appear xml chart xml col_offset, row_offset positioning ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chartsheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a chartsheet to a workbook — wb_add_chartsheet","title":"Add a chartsheet to a workbook — wb_add_chartsheet","text":"chartsheet special type sheet handles charts output. must add chart sheet. Otherwise, break workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chartsheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a chartsheet to a workbook — wb_add_chartsheet","text":"","code":"wb_add_chartsheet( wb, sheet = next_sheet(), tab_color = NULL, zoom = 100, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chartsheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a chartsheet to a workbook — wb_add_chartsheet","text":"wb Workbook object attach new chartsheet sheet name new chartsheet tab_color Color sheet tab. wb_color(), valid color (belonging grDevices::colors()) valid hex color beginning \"#\". zoom sheet zoom level, numeric 10 400 percentage. (zoom value smaller 10 default 10.) visible FALSE, sheet hidden else visible. ... Additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":null,"dir":"Reference","previous_headings":"","what":"Add comment to worksheet — wb_add_comment","title":"Add comment to worksheet — wb_add_comment","text":"Add comment worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add comment to worksheet — wb_add_comment","text":"","code":"wb_add_comment(wb, sheet = current_sheet(), dims = \"A1\", comment, ...) wb_remove_comment(wb, sheet = current_sheet(), dims = \"A1\", ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add comment to worksheet — wb_add_comment","text":"wb workbook object sheet worksheet workbook dims Optional row column spreadsheet dimension, e.g. \"A1\" comment comment apply dims created wb_comment(), string fmt_txt() object ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add comment to worksheet — wb_add_comment","text":"Workbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add comment to worksheet — wb_add_comment","text":"applying comment string, use wb_comment() default values.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add comment to worksheet — wb_add_comment","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") # add a comment without author c1 <- wb_comment(text = \"this is a comment\", author = \"\") wb$add_comment(dims = \"B10\", comment = c1) #' # Remove comment wb$remove_comment(sheet = \"Sheet 1\", dims = \"B10\") # Write another comment with author information c2 <- wb_comment(text = \"this is another comment\", author = \"Marco Polo\", visible = TRUE) wb$add_comment(sheet = 1, dims = \"C10\", comment = c2) # Works with formatted text also. formatted_text <- fmt_txt(\"bar\", underline = TRUE) wb$add_comment(dims = \"B5\", comment = formatted_text)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":null,"dir":"Reference","previous_headings":"","what":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"Add conditional formatting cells. can find details vignette(\"conditional-formatting\").","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"","code":"wb_add_conditional_formatting( wb, sheet = current_sheet(), dims = NULL, rule = NULL, style = NULL, type = c(\"expression\", \"colorScale\", \"dataBar\", \"iconSet\", \"duplicatedValues\", \"uniqueValues\", \"containsErrors\", \"notContainsErrors\", \"containsBlanks\", \"notContainsBlanks\", \"containsText\", \"notContainsText\", \"beginsWith\", \"endsWith\", \"between\", \"topN\", \"bottomN\"), params = list(showValue = TRUE, gradient = TRUE, border = TRUE, percent = FALSE, rank = 5L), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"wb Workbook object sheet name index worksheet dims cell cell range like \"A1\" \"A1:B2\" rule condition apply formatting. See Examples. style style apply cells satisfy rule. Default font_color = \"FF9C0006\" bg_fill = \"FFFFC7CE\" type type conditional formatting rule apply. One \"expression\", \"colorScale\" others mentioned Details. params list additional parameters passed. See Details . ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"openxml uses alpha channel first RGB, whereas usual default RGBA. Conditional formatting type accept different parameters. Unless noted, unlisted parameters ignored. expression [style] Style object[rule] Excel expression (character). Valid operators : <, <=, >, >=, ==, != colorScale [style] character vector valid colors length 2 3[rule]NULL character vector valid colors equal length styles dataBar [style] character vector valid colors length 2 3[rule] numeric vector specifying range databar colors. Must equal length style[params$showValue] FALSE cell value hidden. Default TRUE[params$gradient] FALSE color gradient removed. Default TRUE[params$border] FALSE border around database hidden. Default TRUE duplicatedValues / uniqueValues / containsErrors [style] Style object contains [style] Style object[rule] text look within cells [style] Style object.[rule] numeric vector length 2 specifying lower upper bound (Inclusive) topN [style] Style object[params$rank] numeric vector length 1 indicating number highest values. Default 5L[params$percent] TRUE, uses percentage bottomN [style] Style object[params$rank] numeric vector length 1 indicating number lowest values. Default 5L[params$percent] TRUE, uses percentage iconSet [params$showValue] FALSE, cell value hidden. Default TRUE[params$reverse] TRUE, order reversed. Default FALSE[params$percent] TRUE, uses percentage[params$iconSet] Uses one implemented icon sets. Values must match length icons set 3Arrows, 3ArrowsGray, 3Flags, 3Signs, 3Symbols, 3Symbols2, 3TrafficLights1, 3TrafficLights2, 4Arrows, 4ArrowsGray, 4Rating, 4RedToBlack, 4TrafficLights, 5Arrows, 5ArrowsGray, 5Quarters, 5Rating. default 3TrafficLights1.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"a\") wb$add_data(x = 1:4, col_names = FALSE) wb$add_conditional_formatting(dims = wb_dims(cols = \"A\", rows = 1:4), rule = \">2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Add data to a worksheet — wb_add_data","title":"Add data to a worksheet — wb_add_data","text":"Add data worksheet optional styling.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add data to a worksheet — wb_add_data","text":"","code":"wb_add_data( wb, sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, col_names = TRUE, row_names = FALSE, with_filter = FALSE, name = NULL, sep = \", \", apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add data to a worksheet — wb_add_data","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x Object written. classes supported look examples. dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . array bool function written type array col_names TRUE, column names x written. row_names TRUE, row names x written. with_filter TRUE, add filters column name row. NOTE: can one filter per worksheet. name name named region specified. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add data to a worksheet — wb_add_data","text":"wbWorkbook, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add data to a worksheet — wb_add_data","text":"Formulae written using wb_add_formula() Workbook object get picked read_xlsx(). formula written left Excel evaluate formula file opened Excel. string \"_openxlsx_NA\" reserved openxlsx2. data frame contains string, output broken. Many base classes covered, though far third-party classes. data unknown class written, handled .character().","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add data to a worksheet — wb_add_data","text":"","code":"## See formatting vignette for further examples. ## Options for default styling (These are the defaults) options(\"openxlsx2.dateFormat\" = \"mm/dd/yyyy\") options(\"openxlsx2.datetimeFormat\" = \"yyyy-mm-dd hh:mm:ss\") options(\"openxlsx2.numFmt\" = NULL) ############################################################################# ## Create Workbook object and add worksheets wb <- wb_workbook() ## Add worksheets wb$add_worksheet(\"Cars\") wb$add_worksheet(\"Formula\") x <- mtcars[1:6, ] wb$add_data(\"Cars\", x, start_col = 2, start_row = 3, row_names = TRUE) ############################################################################# ## Hyperlinks ## - vectors/columns with class 'hyperlink' are written as hyperlinks' v <- rep(\"https://CRAN.R-project.org/\", 4) names(v) <- paste0(\"Hyperlink\", 1:4) # Optional: names will be used as display text class(v) <- \"hyperlink\" wb$add_data(\"Cars\", x = v, dims = \"B32\") ############################################################################# ## Formulas ## - vectors/columns with class 'formula' are written as formulas' df <- data.frame( x = 1:3, y = 1:3, z = paste(paste0(\"A\", 1:3 + 1L), paste0(\"B\", 1:3 + 1L), sep = \"+\"), stringsAsFactors = FALSE ) class(df$z) <- c(class(df$z), \"formula\") wb$add_data(sheet = \"Formula\", x = df) ############################################################################# # update cell range and add mtcars xlsxFile <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb2 <- wb_load(xlsxFile) # read dataset with inlinestr wb_to_df(wb2) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 wb2 <- wb2 %>% wb_add_data(sheet = 1, mtcars, dims = wb_dims(4, 4)) wb_to_df(wb2) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 NA #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA mpg cyl disp hp drat wt qsec vs #> 5 TRUE 2 21 6 160 1900-04-19 3.9 2.62 11:02:24 0 #> 6 FALSE 2 21 6 160 110 3.9 2.875 00:28:48 0 #> 7 FALSE 3 22.8 4 108 93 3.85 2.32 18.61 1 #> 8 FALSE 1 21.4 6 258 1900-04-19 3.08 3.215 10:33:36 1 #> 9 NA NA 18.7 8 360 175 3.15 3.44 17.02 0 #> 10 FALSE 2 18.1 6 225 1900-04-14 2.76 3.46 20.22 1 #> 11 FALSE 3 14.3 8 360 1900-09-01 3.21 3.57 15.84 0 #> 12 NA 1 24.4 4 146.7 1900-03-02 3.69 3.19 20 1 #> 13 NA NA 22.8 4 140.8 95 3.92 3.15 22.9 1 #> 14 NA NA 19.2 6 167.6 123 3.92 3.44 18.3 1 #> 15 NA NA 17.8 6 167.6 123 3.92 3.44 18.9 1 #> 16 NA NA 16.4 8 275.8 180 3.07 4.07 17.4 0 #> 17 NA NA 17.3 8 275.8 180 3.07 3.73 17.6 0 #> 18 NA NA 15.2 8 275.8 180 3.07 3.78 18 0 #> 19 NA NA 10.4 8 472 205 2.93 5.25 17.98 0 #> 20 NA NA 10.4 8 460 215 3 5.424 17.82 0 #> 21 NA NA 14.7 8 440 230 3.23 5.345 17.42 0 #> 22 NA NA 32.4 4 78.7 66 4.08 2.2 19.47 1 #> 23 NA NA 30.4 4 75.7 52 4.93 1.615 18.52 1 #> 24 NA NA 33.9 4 71.1 65 4.22 1.835 19.9 1 #> 25 NA NA 21.5 4 120.1 97 3.7 2.465 20.01 1 #> 26 NA NA 15.5 8 318 150 2.76 3.52 16.87 0 #> 27 NA NA 15.2 8 304 150 3.15 3.435 17.3 0 #> 28 NA NA 13.3 8 350 245 3.73 3.84 15.41 0 #> 29 NA NA 19.2 8 400 175 3.08 3.845 17.05 0 #> 30 NA NA 27.3 4 79 66 4.08 1.935 18.9 1 #> 31 NA NA 26 4 120.3 91 4.43 2.14 16.7 0 #> 32 NA NA 30.4 4 95.1 113 3.77 1.513 16.9 1 #> 33 NA NA 15.8 8 351 264 4.22 3.17 14.5 0 #> 34 NA NA 19.7 6 145 175 3.62 2.77 15.5 0 #> 35 NA NA 15 8 301 335 3.54 3.57 14.6 0 #> 36 NA NA 21.4 4 121 109 4.11 2.78 18.6 1 #> NA NA NA #> 3 #> 4 am gear carb #> 5 1 4 4 #> 6 1 4 4 #> 7 1 4 1 #> 8 0 3 1 #> 9 0 3 2 #> 10 0 3 1 #> 11 0 3 4 #> 12 0 4 2 #> 13 0 4 2 #> 14 0 4 4 #> 15 0 4 4 #> 16 0 3 3 #> 17 0 3 3 #> 18 0 3 3 #> 19 0 3 4 #> 20 0 3 4 #> 21 0 3 4 #> 22 1 4 1 #> 23 1 4 2 #> 24 1 4 1 #> 25 0 3 1 #> 26 0 3 2 #> 27 0 3 2 #> 28 0 3 4 #> 29 0 3 2 #> 30 1 4 1 #> 31 1 5 2 #> 32 1 5 2 #> 33 1 5 4 #> 34 1 5 6 #> 35 1 5 8 #> 36 1 4 2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a data table to a worksheet — wb_add_data_table","title":"Add a data table to a worksheet — wb_add_data_table","text":"Add data worksheet format Excel table.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a data table to a worksheet — wb_add_data_table","text":"","code":"wb_add_data_table( wb, sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, col_names = TRUE, row_names = FALSE, table_style = \"TableStyleLight9\", table_name = NULL, with_filter = TRUE, sep = \", \", first_column = FALSE, last_column = FALSE, banded_rows = TRUE, banded_cols = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a data table to a worksheet — wb_add_data_table","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x data frame dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . col_names TRUE, column names x written. row_names TRUE, row names x written. table_style table style name \"none\" (see vignette(\"openxlsx2_style_manual\")) table_name Name table workbook. table name must unique. with_filter TRUE, columns filters first row. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). options correspond Excel table options: first_column logical. TRUE, first column bold. last_column logical. TRUE, last column bold. banded_rows logical. TRUE, rows color banded. banded_cols logical. TRUE, columns color banded. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a data table to a worksheet — wb_add_data_table","text":"columns x class Date/POSIXt, currency, accounting, hyperlink, percentage automatically styled dates, currency, accounting, hyperlinks, percentages respectively. string \"_openxlsx_NA\" reserved openxlsx2. x contains string, output broken.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":null,"dir":"Reference","previous_headings":"","what":"Add data validation to cells in a worksheet — wb_add_data_validation","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"Add Excel data validation cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"","code":"wb_add_data_validation( wb, sheet = current_sheet(), dims = \"A1\", type, operator, value, allow_blank = TRUE, show_input_msg = TRUE, show_error_msg = TRUE, error_style = NULL, error_title = NULL, error = NULL, prompt_title = NULL, prompt = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"wb Workbook object sheet name index worksheet dims cell dimension (\"A1\" \"A1:B2\") type One 'whole', 'decimal', 'date', 'time', 'textLength', 'list' (see examples) operator One '', 'notBetween', 'equal', 'notEqual', 'greaterThan', 'lessThan', 'greaterThanOrEqual', 'lessThanOrEqual' value vector length 1 2 depending operator (see examples) allow_blank logical show_input_msg logical show_error_msg logical error_style icon shown options deal inputs. Default \"stop\" (cancel), else \"information\" (prompt popup) \"warning\" (prompt accept change input) error_title error title error error text prompt_title prompt title prompt prompt text ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_data_table(1, x = iris[1:30, ]) wb$add_data_validation(1, dims = \"A2:C31\", type = \"whole\", operator = \"between\", value = c(1, 9) ) wb$add_data_validation(1, dims = \"E2:E31\", type = \"textLength\", operator = \"between\", value = c(4, 6) ) ## Date and Time cell validation df <- data.frame( \"d\" = as.Date(\"2016-01-01\") + -5:5, \"t\" = as.POSIXct(\"2016-01-01\") + -5:5 * 10000 ) wb$add_data_table(2, x = df) wb$add_data_validation(2, dims = \"A2:A12\", type = \"date\", operator = \"greaterThanOrEqual\", value = as.Date(\"2016-01-01\") ) wb$add_data_validation(2, dims = \"B2:B12\", type = \"time\", operator = \"between\", value = df$t[c(4, 8)] ) ###################################################################### ## If type == 'list' # operator argument is ignored. wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_data_table(sheet = 1, x = iris[1:30, ]) wb$add_data(sheet = 2, x = sample(iris$Sepal.Length, 10)) wb$add_data_validation(1, dims = \"A2:A31\", type = \"list\", value = \"'Sheet 2'!$A$1:$A$10\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":null,"dir":"Reference","previous_headings":"","what":"Add drawings to a worksheet — wb_add_drawing","title":"Add drawings to a worksheet — wb_add_drawing","text":"Add drawings worksheet. requires rvg package.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add drawings to a worksheet — wb_add_drawing","text":"","code":"wb_add_drawing( wb, sheet = current_sheet(), dims = \"A1\", xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add drawings to a worksheet — wb_add_drawing","text":"wb wbWorkbook sheet sheet workbook dims dimension drawing added. xml drawing xml character file col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add drawings to a worksheet — wb_add_drawing","text":"","code":"if (requireNamespace(\"rvg\") && interactive()) { ## rvg example require(rvg) tmp <- tempfile(fileext = \".xml\") dml_xlsx(file = tmp) plot(1,1) dev.off() wb <- wb_workbook()$ add_worksheet()$ add_drawing(xml = tmp)$ add_drawing(xml = tmp, dims = NULL) } #> Loading required namespace: rvg"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Set a dxfs styling for the workbook — wb_add_dxfs_style","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"styles used conditional formatting custom table styles.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"","code":"wb_add_dxfs_style( wb, name, font_name = NULL, font_size = NULL, font_color = NULL, num_fmt = NULL, border = NULL, border_color = wb_color(getOption(\"openxlsx2.borderColor\", \"black\")), border_style = getOption(\"openxlsx2.borderStyle\", \"thin\"), bg_fill = NULL, gradient_fill = NULL, text_bold = NULL, text_italic = NULL, text_underline = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"wb Workbook object. name style name font_name font name font_size font size font_color font color (wb_color() object) num_fmt number format border logical borders applied border_color border color border_style border style bg_fill background fill gradient_fill gradient fill text_bold logical text bold text_italic logical text italic text_underline logical text underlined ... additional arguments passed create_dxfs_style()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"Workbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_dxfs_style( name = \"nay\", font_color = wb_color(hex = \"FF9C0006\"), bg_fill = wb_color(hex = \"FFFFC7CE\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the background fill color in a cell region — wb_add_fill","title":"Modify the background fill color in a cell region — wb_add_fill","text":"Add fill cell region.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the background fill color in a cell region — wb_add_fill","text":"","code":"wb_add_fill( wb, sheet = current_sheet(), dims = \"A1\", color = wb_color(hex = \"FFFFFF00\"), pattern = \"solid\", gradient_fill = \"\", every_nth_col = 1, every_nth_row = 1, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the background fill color in a cell region — wb_add_fill","text":"wb workbook sheet worksheet dims cell range color colors apply, e.g. yellow: wb_color(hex = \"FFFFFF00\") pattern various default \"none\" others possible: \"solid\", \"mediumGray\", \"darkGray\", \"lightGray\", \"darkHorizontal\", \"darkVertical\", \"darkDown\", \"darkUp\", \"darkGrid\", \"darkTrellis\", \"lightHorizontal\", \"lightVertical\", \"lightDown\", \"lightUp\", \"lightGrid\", \"lightTrellis\", \"gray125\", \"gray0625\" gradient_fill gradient fill xml pattern. every_nth_col col filled every_nth_row row filled ... ...","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the background fill color in a cell region — wb_add_fill","text":"wbWorkbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the background fill color in a cell region — wb_add_fill","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb <- wb %>% wb_add_fill(\"S1\", dims = \"D5:J23\", color = wb_color(hex = \"FFFFFF00\")) wb <- wb %>% wb_add_fill(\"S1\", dims = \"B22:D27\", color = wb_color(hex = \"FF00FF00\")) wb <- wb %>% wb_add_worksheet(\"S2\") %>% wb_add_data(\"S2\", mtcars) gradient_fill1 <- ' <\/stop> <\/stop> <\/gradientFill>' wb <- wb %>% wb_add_fill(\"S2\", dims = \"A2:K5\", gradient_fill = gradient_fill1) gradient_fill2 <- ' <\/stop> <\/stop> <\/gradientFill>' wb <- wb %>% wb_add_fill(\"S2\", dims = \"A7:K10\", gradient_fill = gradient_fill2)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify font in a cell region — wb_add_font","title":"Modify font in a cell region — wb_add_font","text":"Modify font cell region precision can specify font cell cell styling functions, wb_add_font() gives control.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify font in a cell region — wb_add_font","text":"","code":"wb_add_font( wb, sheet = current_sheet(), dims = \"A1\", name = \"Calibri\", color = wb_color(hex = \"FF000000\"), size = \"11\", bold = \"\", italic = \"\", outline = \"\", strike = \"\", underline = \"\", charset = \"\", condense = \"\", extend = \"\", family = \"\", scheme = \"\", shadow = \"\", vert_align = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify font in a cell region — wb_add_font","text":"wb Workbook object sheet worksheet dims cell range name Font name: default \"Calibri\" color object created wb_color() size Font size: default \"11\", bold bold, \"single\" \"double\", default: \"\" italic italic outline outline strike strike underline underline charset charset condense condense extend extend family font family scheme font scheme shadow shadow vert_align vertical alignment ... ...","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify font in a cell region — wb_add_font","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify font in a cell region — wb_add_font","text":"wb_add_font() provides options openxml accepts font node, set. Usually name, size color user wants.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify font in a cell region — wb_add_font","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb %>% wb_add_font(\"S1\", \"A1:K1\", name = \"Arial\", color = wb_color(theme = \"4\")) # With chaining wb <- wb_workbook()$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_font(\"S1\", \"A1:K1\", name = \"Arial\", color = wb_color(theme = \"4\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"can add Form Control cell. three supported types Checkbox, Radio button, Drop menu.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"","code":"wb_add_form_control( wb, sheet = current_sheet(), dims = \"A1\", type = c(\"Checkbox\", \"Radio\", \"Drop\"), text = NULL, link = NULL, range = NULL, checked = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"wb Workbook object sheet worksheet workbook dims single cell spreadsheet dimension, e.g. \"A1\". type type \"Checkbox\" (default), \"Radio\" radio button \"Drop\" drop menu text text shown next Checkbox radio button (optional) link cell range link range cell range used input checked logical indicating Checkbox Radio button checked","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_form_control() # Add wb$add_form_control(dims = \"C5\", type = \"Radio\", checked = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a formula to a cell range in a worksheet — wb_add_formula","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"function can used add formula worksheet. wb_add_formula(), can provide formula character vector.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"","code":"wb_add_formula( wb, sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, cm = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"wb Workbook object containing worksheet. sheet worksheet write . (either index name) x formula character vector. dims Spreadsheet dimensions determine x spans: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write . start_row vector specifying starting row write . array bool function written type array cm special kind array function hides curly braces cell. Add , see \"@\" inserted formulas. apply_cell_style write cell styles workbook? remove_cell_style keep cell style? ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"workbook, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"Currently, local translations formulas supported. English functions work. examples show small list possible formulas: SUM(B2:B4) AVERAGE(B2:B4) MIN(B2:B4) MAX(B2:B4) ...","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"","code":"wb <- wb_workbook()$add_worksheet() wb$add_data(dims = wb_dims(rows = 1, cols = 1:3), x = t(c(4, 5, 8)), col_names = FALSE) # calculate the sum of elements. wb$add_formula(dims = \"D1\", x = \"SUM(A1:C1)\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":null,"dir":"Reference","previous_headings":"","what":"Ignore error types on worksheet — wb_add_ignore_error","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"function allows hide / ignore certain types errors shown worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"","code":"wb_add_ignore_error( wb, sheet = current_sheet(), dims = \"A1\", calculated_column = FALSE, empty_cell_reference = FALSE, eval_error = FALSE, formula = FALSE, formula_range = FALSE, list_data_validation = FALSE, number_stored_as_text = FALSE, two_digit_text_year = FALSE, unlocked_formula = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"wb workbook sheet sheet name index. dims Cell range ignore error calculated_column calculatedColumn empty_cell_reference emptyCellReference eval_error evalError formula formula formula_range formulaRange list_data_validation listDataValidation number_stored_as_text TRUE, display error numbers stored text. two_digit_text_year twoDigitTextYear unlocked_formula unlockedFormula ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":null,"dir":"Reference","previous_headings":"","what":"Insert an image into a worksheet — wb_add_image","title":"Insert an image into a worksheet — wb_add_image","text":"Insert image worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Insert an image into a worksheet — wb_add_image","text":"","code":"wb_add_image( wb, sheet = current_sheet(), dims = \"A1\", file, width = 6, height = 3, row_offset = 0, col_offset = 0, units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Insert an image into a worksheet — wb_add_image","text":"wb workbook object sheet name index worksheet dims Dimensions plot. Default absolute anchor, single cell (eg. \"A1\") oneCellAnchor, cell range (eg. \"A1:D4\") twoCellAnchor file image file. Valid file types : \"jpeg\", \"png\", \"bmp\" width Width figure. height Height figure. row_offset offset vector one two cell anchor within cell (row) col_offset offset vector one two cell anchor within cell (column) units Units width height. Can \"\", \"cm\" \"px\" dpi Image resolution used conversion units. ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Insert an image into a worksheet — wb_add_image","text":"","code":"img <- system.file(\"extdata\", \"einstein.jpg\", package = \"openxlsx2\") wb <- wb_workbook()$ add_worksheet()$ add_image(\"Sheet 1\", dims = \"C5\", file = img, width = 6, height = 5)$ add_worksheet()$ add_image(dims = \"B2\", file = img)$ add_worksheet()$ add_image(dims = \"G3\", file = img, width = 15, height = 12, units = \"cm\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":null,"dir":"Reference","previous_headings":"","what":"Add mschart object to a worksheet — wb_add_mschart","title":"Add mschart object to a worksheet — wb_add_mschart","text":"Add mschart object worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add mschart object to a worksheet — wb_add_mschart","text":"","code":"wb_add_mschart( wb, sheet = current_sheet(), dims = NULL, graph, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add mschart object to a worksheet — wb_add_mschart","text":"wb workbook sheet sheet graph appear dims dimensions sheet appear graph mschart object col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add mschart object to a worksheet — wb_add_mschart","text":"","code":"if (requireNamespace(\"mschart\")) { require(mschart) ## Add mschart to worksheet (adds data and chart) scatter <- ms_scatterchart(data = iris, x = \"Sepal.Length\", y = \"Sepal.Width\", group = \"Species\") scatter <- chart_settings(scatter, scatterstyle = \"marker\") wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_mschart(dims = \"F4:L20\", graph = scatter) ## Add mschart to worksheet and use available data wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars, dims = \"B2\") # create wb_data object dat <- wb_data(wb, 1, dims = \"B2:E6\") # call ms_scatterplot data_plot <- ms_scatterchart( data = dat, x = \"mpg\", y = c(\"disp\", \"hp\"), labels = c(\"disp\", \"hp\") ) # add the scatterplot to the data wb <- wb %>% wb_add_mschart(dims = \"F4:L20\", graph = data_plot) } #> Loading required namespace: mschart #> Loading required package: mschart"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Apply styling to a cell region with a named style — wb_add_named_style","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"Set styling named style cell region. Use wb_add_cell_style() style cell region custom parameters. named style one spreadsheet software, like \"Normal\", \"Warning\".","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"","code":"wb_add_named_style( wb, sheet = current_sheet(), dims = \"A1\", name = \"Normal\", font_name = NULL, font_size = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"wb wbWorkbook object sheet worksheet dims cell range name named style name. font_name, font_size optional else default theme","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"wbWorkbook, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify number formatting in a cell region — wb_add_numfmt","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"Add number formatting cell region. can use number format created create_numfmt().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"","code":"wb_add_numfmt(wb, sheet = current_sheet(), dims = \"A1\", numfmt)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"wb Workbook sheet worksheet dims cell range numfmt either id character","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"list number formats ID located Details section create_cell_style().","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb %>% wb_add_numfmt(\"S1\", dims = \"F1:F33\", numfmt = \"#.0\") # Chaining wb <- wb_workbook()$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_numfmt(\"S1\", \"A1:A33\", numfmt = 1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a page break to a worksheet — wb_add_page_break","title":"Add a page break to a worksheet — wb_add_page_break","text":"Insert page breaks worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a page break to a worksheet — wb_add_page_break","text":"","code":"wb_add_page_break(wb, sheet = current_sheet(), row = NULL, col = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a page break to a worksheet — wb_add_page_break","text":"wb workbook object sheet name index worksheet row, col Either row number column number. One must NULL","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a page break to a worksheet — wb_add_page_break","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_data(sheet = 1, x = iris) wb$add_page_break(sheet = 1, row = 10) wb$add_page_break(sheet = 1, row = 20) wb$add_page_break(sheet = 1, col = 2) ## In Excel: View tab -> Page Break Preview"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a pivot table to a worksheet — wb_add_pivot_table","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"Add pivot table worksheet. data must specified using wb_data() ensure function works.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"","code":"wb_add_pivot_table( wb, x, sheet = next_sheet(), dims = \"A3\", filter, rows, cols, data, fun, params, pivot_table, slicer )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"wb Workbook object containing #' worksheet. x data.frame inherits wb_data class. sheet worksheet containing #' dims worksheet cell pivot table placed filter column name(s) x used filter. rows column name(s) x used rows cols column names(s) x used cols data column name(s) x used data fun vector functions used data params list parameters modify pivot table creation. pivot_table optional name pivot table slicer character object names used slicer","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"fun can AVERAGE, COUNT, COUNTA, MAX, MIN, PRODUCT, STDEV, STDEVP, SUM, VAR, VARP. show_data_as can normal, difference, percent, percentDiff, runTotal, percentOfRow, percentOfCol, percentOfTotal, index. sheet empty unless opened spreadsheet software.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars) df <- wb_data(wb, sheet = 1) wb <- wb %>% wb_add_pivot_table(df, dims = \"A3\", filter = \"am\", rows = \"cyl\", cols = \"gear\", data = \"disp\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Insert the current plot into a worksheet — wb_add_plot","title":"Insert the current plot into a worksheet — wb_add_plot","text":"current plot saved temporary image file using grDevices::dev.copy() file written workbook using wb_add_image().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Insert the current plot into a worksheet — wb_add_plot","text":"","code":"wb_add_plot( wb, sheet = current_sheet(), dims = \"A1\", width = 6, height = 4, row_offset = 0, col_offset = 0, file_type = \"png\", units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Insert the current plot into a worksheet — wb_add_plot","text":"wb workbook object sheet name index worksheet dims Worksheet dimension, single cell (\"A1\") cell range (\"A1:D4\") width Width figure. Defaults 6 . height Height figure . Defaults 4 . row_offset, col_offset Offset column row file_type File type image units Units width height. Can \"\", \"cm\" \"px\" dpi Image resolution ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Insert the current plot into a worksheet — wb_add_plot","text":"","code":"if (requireNamespace(\"ggplot2\") && interactive()) { ## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\", grid_lines = FALSE) ## create plot objects require(ggplot2) p1 <- ggplot(mtcars, aes(x = mpg, fill = as.factor(gear))) + ggtitle(\"Distribution of Gas Mileage\") + geom_density(alpha = 0.5) p2 <- ggplot(Orange, aes(x = age, y = circumference, color = Tree)) + geom_point() + geom_line() ## Insert currently displayed plot to sheet 1, row 1, column 1 print(p1) # plot needs to be showing wb$add_plot(1, width = 5, height = 3.5, file_type = \"png\", units = \"in\") ## Insert plot 2 print(p2) wb$add_plot(1, dims = \"J2\", width = 16, height = 10, file_type = \"png\", units = \"cm\") } #> Loading required namespace: ggplot2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a slicer to a pivot table — wb_add_slicer","title":"Add a slicer to a pivot table — wb_add_slicer","text":"Add slicer previously created pivot table. function still experimental might changed/improved upcoming releases.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a slicer to a pivot table — wb_add_slicer","text":"","code":"wb_add_slicer( wb, x, dims = \"A1\", sheet = current_sheet(), pivot_table, slicer, params )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a slicer to a pivot table — wb_add_slicer","text":"wb Workbook object containing #' worksheet. x data.frame inherits wb_data class. dims worksheet cell pivot table placed sheet worksheet containing #' pivot_table name pivot table selected sheet slicer variable used slicer pivot table params list parameters modify pivot table creation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a slicer to a pivot table — wb_add_slicer","text":"assumes slicer variable initialization happened . Unfortunately, unlikely can guarantee loaded workbooks, strictly discourage users attempting . variable initialized properly, may cause spreadsheet software crash. time , slicer needs placed slide pivot table.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a slicer to a pivot table — wb_add_slicer","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars) df <- wb_data(wb, sheet = 1) wb <- wb %>% wb_add_pivot_table( df, dims = \"A3\", slicer = \"vs\", rows = \"cyl\", cols = \"gear\", data = \"disp\", pivot_table = \"mtcars\" ) %>% wb_add_slicer(x = df, slicer = \"vs\", pivot_table = \"mtcars\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":null,"dir":"Reference","previous_headings":"","what":"Add sparklines to a worksheet — wb_add_sparklines","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"Add sparklines worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"","code":"wb_add_sparklines(wb, sheet = current_sheet(), sparklines)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"wb wbWorkbook sheet sheet add sparklines sparklines sparklines object created create_sparklines()","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"","code":"sl <- create_sparklines(\"Sheet 1\", dims = \"A3:K3\", sqref = \"L3\") wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars) %>% wb_add_sparklines(sparklines = sl)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the default style in a workbook — wb_add_style","title":"Set the default style in a workbook — wb_add_style","text":"wb wrapper add style workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the default style in a workbook — wb_add_style","text":"","code":"wb_add_style(wb, style = NULL, style_name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the default style in a workbook — wb_add_style","text":"wb workbook style style xml character, created create_*() function. style_name style name used optional argument","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the default style in a workbook — wb_add_style","text":"wbWorkbook object, invisibly.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set the default style in a workbook — wb_add_style","text":"","code":"yellow_f <- wb_color(hex = \"FF9C6500\") yellow_b <- wb_color(hex = \"FFFFEB9C\") yellow <- create_dxfs_style(font_color = yellow_f, bg_fill = yellow_b) wb <- wb_workbook() %>% wb_add_style(yellow)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":null,"dir":"Reference","previous_headings":"","what":"Add threaded comments to a cell in a worksheet — wb_add_thread","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"functions allow adding thread comments spreadsheets. yet supported spreadsheet software. threaded comment must tied person created wb_add_person().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"","code":"wb_add_thread( wb, sheet = current_sheet(), dims = \"A1\", comment = NULL, person_id, reply = FALSE, resolve = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"wb workbook sheet worksheet dims cell comment text add, character vector. person_id person Id added. default getOption(\"openxlsx2.thread_id\") set. reply comment reply? (default FALSE) resolve comment resolved? (default FALSE)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"threaded comment added, needs person attached . default create person provider id \"None\". providers possible specific values id user_id. require following, create workbook via spreadsheet software load get values wb_get_person()","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"","code":"wb <- wb_workbook()$add_worksheet() # Add a person to the workbook. wb$add_person(name = \"someone who likes to edit workbooks\") pid <- wb$get_person(name = \"someone who likes to edit workbooks\")$id # write a comment to a thread, reply to one and solve some wb <- wb %>% wb_add_thread(dims = \"A1\", comment = \"wow it works!\", person_id = pid) %>% wb_add_thread(dims = \"A2\", comment = \"indeed\", person_id = pid, resolve = TRUE) %>% wb_add_thread(dims = \"A1\", comment = \"so cool\", person_id = pid, reply = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a worksheet to a workbook — wb_add_worksheet","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"Add worksheet wbWorkbook first step build workbook. function, can also set sheet view zoom, set headers footers well features. See function arguments.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"","code":"wb_add_worksheet( wb, sheet = next_sheet(), grid_lines = TRUE, row_col_headers = TRUE, tab_color = NULL, zoom = 100, header = NULL, footer = NULL, odd_header = header, odd_footer = footer, even_header = header, even_footer = footer, first_header = header, first_footer = footer, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), has_drawing = FALSE, paper_size = getOption(\"openxlsx2.paperSize\", default = 9), orientation = getOption(\"openxlsx2.orientation\", default = \"portrait\"), hdpi = getOption(\"openxlsx2.hdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), vdpi = getOption(\"openxlsx2.vdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"wb wbWorkbook object attach new worksheet sheet name new worksheet grid_lines logical. FALSE, worksheet grid lines hidden. row_col_headers logical. FALSE, worksheet colname rowname hidden. tab_color Color sheet tab. wb_color(), valid color (belonging grDevices::colors()) valid hex color beginning \"#\". zoom sheet zoom level, numeric 10 400 percentage. (zoom value smaller 10 default 10.) header, odd_header, even_header, first_header, footer, odd_footer, even_footer, first_footer Character vector length 3 corresponding positions left, center, right. header footer used default additional arguments. Setting even, odd, first, overrides header/footer. Use NA skip position. visible FALSE, sheet hidden else visible. has_drawing TRUE prepare drawing output (TODO work?) paper_size integer corresponding paper size. See wb_page_setup() details. orientation One \"portrait\" \"landscape\" hdpi, vdpi Horizontal vertical DPI. Can set options(\"openxlsx2.dpi\" = X), options(\"openxlsx2.hdpi\" = X) options(\"openxlsx2.vdpi\" = X) ... Additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"Headers footers can contain special tags &[Page] Page number &[Pages] Number pages &[Date] Current date &[Time] Current time &[Path] File path &[File] File name &[Tab] Worksheet name","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\") ## No grid lines wb$add_worksheet(\"Sheet 2\", grid_lines = FALSE) ## A red tab color wb$add_worksheet(\"Sheet 3\", tab_color = wb_color(\"red\")) ## All options combined with a zoom of 40% wb$add_worksheet(\"Sheet 4\", grid_lines = FALSE, tab_color = wb_color(hex = \"#4F81BD\"), zoom = 40) ## Headers and Footers wb$add_worksheet(\"Sheet 5\", header = c(\"ODD HEAD LEFT\", \"ODD HEAD CENTER\", \"ODD HEAD RIGHT\"), footer = c(\"ODD FOOT RIGHT\", \"ODD FOOT CENTER\", \"ODD FOOT RIGHT\"), even_header = c(\"EVEN HEAD LEFT\", \"EVEN HEAD CENTER\", \"EVEN HEAD RIGHT\"), even_footer = c(\"EVEN FOOT RIGHT\", \"EVEN FOOT CENTER\", \"EVEN FOOT RIGHT\"), first_header = c(\"TOP\", \"OF FIRST\", \"PAGE\"), first_footer = c(\"BOTTOM\", \"OF FIRST\", \"PAGE\") ) wb$add_worksheet(\"Sheet 6\", header = c(\"&[Date]\", \"ALL HEAD CENTER 2\", \"&[Page] / &[Pages]\"), footer = c(\"&[Path]&[File]\", NA, \"&[Tab]\"), first_header = c(NA, \"Center Header of First Page\", NA), first_footer = c(NA, \"Center Footer of First Page\", NA) ) wb$add_worksheet(\"Sheet 7\", header = c(\"ALL HEAD LEFT 2\", \"ALL HEAD CENTER 2\", \"ALL HEAD RIGHT 2\"), footer = c(\"ALL FOOT RIGHT 2\", \"ALL FOOT CENTER 2\", \"ALL FOOT RIGHT 2\") ) wb$add_worksheet(\"Sheet 8\", first_header = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\"), first_footer = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\") ) ## Need data on worksheet to see all headers and footers wb$add_data(sheet = 5, 1:400) wb$add_data(sheet = 6, 1:400) wb$add_data(sheet = 7, 1:400) wb$add_data(sheet = 8, 1:400)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Apply styling to a cell region — wb_cell_style","title":"Apply styling to a cell region — wb_cell_style","text":"Apply styling cell region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Apply styling to a cell region — wb_cell_style","text":"","code":"wb_get_cell_style(wb, sheet = current_sheet(), dims) wb_set_cell_style(wb, sheet = current_sheet(), dims, style)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Apply styling to a cell region — wb_cell_style","text":"wb wbWorkbook object sheet sheet dims cell range worksheet style style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Apply styling to a cell region — wb_cell_style","text":"wb_get_cell_style returns style id character wb_set_cell_style returns workbook invisibly.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Apply styling to a cell region — wb_cell_style","text":"","code":"# set a style in b1 wb <- wb_workbook()$add_worksheet()$ add_numfmt(dims = \"B1\", numfmt = \"#,0\") # get style from b1 to assign it to a1 numfmt <- wb$get_cell_style(dims = \"B1\") # assign style to a1 wb$set_cell_style(dims = \"A1\", style = numfmt)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove all values in a worksheet — wb_clean_sheet","title":"Remove all values in a worksheet — wb_clean_sheet","text":"Remove content worksheet completely, region specifying dims.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove all values in a worksheet — wb_clean_sheet","text":"","code":"wb_clean_sheet( wb, sheet = current_sheet(), dims = NULL, numbers = TRUE, characters = TRUE, styles = TRUE, merged_cells = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove all values in a worksheet — wb_clean_sheet","text":"wb Workbook object sheet sheet clean dims spreadsheet dimensions (optional) numbers remove numbers characters remove characters styles remove styles merged_cells remove merged_cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove all values in a worksheet — wb_clean_sheet","text":"Workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_sheet_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","title":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","text":"function can used apply styling cell range, apply another cell range.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_sheet_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","text":"","code":"wb_clone_sheet_style(wb, from = current_sheet(), to)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_sheet_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","text":"wb workbook sheet select style sheet apply style ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Create copies of a worksheet within a workbook — wb_clone_worksheet","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"Create copy worksheet wbWorkbook object. Cloning possible limited extent. References sheet names formulas, charts, pivot tables, etc. may updated. elements like named ranges slicers cloned yet. Cloning another workbook still experimental feature might work reliably. Cloning data, media, charts tables work. Slicers pivot tables well everything everything relying dxfs styles (e.g. custom table styles conditional formatting) currently implemented. Formula references updated reflect interactions workbooks.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"","code":"wb_clone_worksheet(wb, old = current_sheet(), new = next_sheet(), from = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"wb wbWorkbook object old Name existing worksheet copy new Name new worksheet create (optional) Workbook clone old ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"wbWorkbook object, invisibly.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"","code":"# Create a new workbook wb <- wb_workbook() # Add worksheets wb$add_worksheet(\"Sheet 1\") wb$clone_worksheet(\"Sheet 1\", new = \"Sheet 2\") # Take advantage of waiver functions wb$clone_worksheet(old = \"Sheet 1\") ## cloning from another workbook # create a workbook wb <- wb_workbook()$ add_worksheet(\"NOT_SUM\")$ add_data(x = head(iris))$ add_fill(dims = \"A1:B2\", color = wb_color(\"yellow\"))$ add_border(dims = \"B2:C3\") # we will clone this styled chart into another workbook fl <- system.file(\"extdata\", \"oxlsx2_sheet.xlsx\", package = \"openxlsx2\") wb_from <- wb_load(fl) # clone styles and shared strings wb$clone_worksheet(old = \"SUM\", new = \"SUM\", from = wb_from)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a color — wb_color","title":"Helper to create a color — wb_color","text":"Creates wbColour object.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a color — wb_color","text":"","code":"wb_color( name = NULL, auto = NULL, indexed = NULL, hex = NULL, theme = NULL, tint = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a color — wb_color","text":"name name color known R auto boolean. indexed indexed color values. hex rgb color ARGB hex value \"FF000000\". theme zero based index referencing value theme. tint tint value applied. Range -1 (dark) 1 (light).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper to create a color — wb_color","text":"wbColour object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a comment object — wb_comment","title":"Helper to create a comment object — wb_comment","text":"Creates wbComment object. Use wb_add_comment() add worksheet location.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a comment object — wb_comment","text":"","code":"wb_comment( text = NULL, style = NULL, visible = FALSE, author = getOption(\"openxlsx2.creator\"), width = 2, height = 4 )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a comment object — wb_comment","text":"text Comment text. Character vector. fmt_txt() string. style Style object list style objects length comment vector. visible comment visible? Default: FALSE. author Author comment. string. default, look options(\"openxlsx2.creator\"). Otherwise, check system username. width Textbox integer width number cells height Textbox integer height number cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper to create a comment object — wb_comment","text":"wbComment object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper to create a comment object — wb_comment","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") # write comment without author c1 <- wb_comment(text = \"this is a comment\", author = \"\", visible = TRUE) wb$add_comment(dims = \"B10\", comment = c1) # Write another comment with author information c2 <- wb_comment(text = \"this is another comment\", author = \"Marco Polo\") wb$add_comment(sheet = 1, dims = \"C10\", comment = c2) # write a styled comment with system author s1 <- create_font(b = \"true\", color = wb_color(hex = \"FFFF0000\"), sz = \"12\") s2 <- create_font(color = wb_color(hex = \"FF000000\"), sz = \"9\") c3 <- wb_comment(text = c(\"This Part Bold red\\n\\n\", \"This part black\"), style = c(s1, s2)) wb$add_comment(sheet = 1, dims = wb_dims(3, 6), comment = c3)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":null,"dir":"Reference","previous_headings":"","what":"Copy cells around within a worksheet — wb_copy_cells","title":"Copy cells around within a worksheet — wb_copy_cells","text":"Copy cells around within worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Copy cells around within a worksheet — wb_copy_cells","text":"","code":"wb_copy_cells( wb, sheet = current_sheet(), dims = \"A1\", data, as_value = FALSE, as_ref = FALSE, transpose = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Copy cells around within a worksheet — wb_copy_cells","text":"wb workbook sheet worksheet dims cell place copy data wb_data object containing cells copy as_value copy value written? as_ref references cell written? transpose data written transposed? ... additional arguments passed add_data() used as_value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Copy cells around within a worksheet — wb_copy_cells","text":"wbWorkbook invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Copy cells around within a worksheet — wb_copy_cells","text":"","code":"wb <- wb_workbook()$ add_worksheet()$ add_data(x = mtcars)$ add_fill(dims = \"A1:F1\", color = wb_color(\"yellow\")) dat <- wb_data(wb, dims = \"A1:D4\", col_names = FALSE) # 1:1 copy to M2 wb$ clone_worksheet(old = 1, new = \"Clone1\")$ copy_cells(data = dat, dims = \"M2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Add the wb_data attribute to a data frame in a worksheet — wb_data","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"provide wb_data object mschart input","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"","code":"wb_data(wb, sheet = current_sheet(), dims, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"wb workbook sheet sheet workbook either name index dims dimensions ... additional arguments wb_to_df(). aware every argument valid.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"data frame class wb_data.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars, dims = \"B2\") wb_data(wb, 1, dims = \"B2:E6\") #> mpg cyl disp hp #> 3 21.0 6 160 110 #> 4 21.0 6 160 110 #> 5 22.8 4 108 93 #> 6 21.4 6 258 110"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to specify the dims argument — wb_dims","title":"Helper to specify the dims argument — wb_dims","text":"wb_dims() can used help provide dims argument, wb_add_* functions. returns A1 spreadsheet range (\"A1:B1\" \"A2\"). can useful can specify many parameters interact together general, must provide named arguments. wb_dims() accept unnamed arguments rows, cols, example wb_dims(1:4, 1:2), return \"A1:B4\". wb_dims() can also used object (data.frame matrix example.) parameters numeric unless stated otherwise.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to specify the dims argument — wb_dims","text":"","code":"wb_dims(..., select = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to specify the dims argument — wb_dims","text":"... construct dims arguments, rows/cols vectors objects can coerced data frame. x, rows, cols, from_row, from_col, row_names, col_names accepted. select string, one followings. improves selection various parts x One \"x\", \"data\", \"col_names\", \"row_names\". \"data\" select data part, excluding row names column names (default cols rows specified) \"x\" Includes data, column row names present. (default none rows cols provided) \"col_names\" return column names \"row_names\" return row names.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper to specify the dims argument — wb_dims","text":"dims string","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Helper to specify the dims argument — wb_dims","text":"using wb_dims() object, default behavior select data / row columns x need another behavior, use wb_dims() without supplying x. x object (typically matrix data.frame, vector also accepted.) from_row / from_col starting position x (dims returned assume top left corner x from_row / from_col rows Optional row span x apply . rows = 0, column names affected. cols range columns id x, one column names x (length 1 accepted column names x.) row_names logical, let wb_dims() know x row names . row_names = TRUE, wb_dims() increment from_col 1. col_names wb_dims() assumes x column names, trying find dims. wb_dims() tries support possible cases row_names = TRUE col_names = FALSE, works best x named dimensions (data.frame, matrix), parameters specified. data column names, without row names. code clean. add_data() / add_font() example, writing data row names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"using-wb-dims-without-an-x-object","dir":"Reference","previous_headings":"","what":"Using wb_dims() without an x object","title":"Helper to specify the dims argument — wb_dims","text":"rows / cols (want specify single one, use from_row / from_col) from_row / from_col starting position dims (similar start_row / start_col, clearer name.)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"using-wb-dims-with-an-x-object","dir":"Reference","previous_headings":"","what":"Using wb_dims() with an x object","title":"Helper to specify the dims argument — wb_dims","text":"wb_dims() object 8 use-cases (work position values from_row / from_col), from_col/from_row correspond coordinates top left x including column row names present. use cases provided without from_row / from_col, work also from_row / from_col. provide full grid wb_dims(x = mtcars) provide data grid wb_dims(x = mtcars, select = \"data\") provide dims column names wb_dims(x = mtcars, select = \"col_names) provide dims row names wb_dims(x = mtcars, row_names = TRUE, select = \"row_names\") provide dims row span wb_dims(x = mtcars, rows = 1:10) selects first 10 data rows mtcars (ignoring column names) provide dims data column span wb_dims(x = mtcars, cols = 1:5) select data first 5 columns mtcars provide column span (including column names) wb_dims(x = mtcars, cols = 4:7, select = \"x\") select data columns 4, 5, 6, 7 mtcars + column names provide position single column name wb_dims(x = mtcars, cols = \"mpg\"). provide row span column. wb_dims(x = mtcars, cols = \"mpg\", rows = 5:22) reuse, good trick create wrapper function, styling can performed seamlessly. can useful apply many rounds styling sequentially.","code":"wb_dims_cars <- function(...) { wb_dims(x = mtcars, from_row = 2, from_col = \"B\", ...) } # using this function wb_dims_cars() # full grid (data + column names) wb_dims_cars(select = \"data\") # data only wb_dims_cars(select = \"col_names\") # select column names wb_dims_cars(cols = \"vs\") # select the `vs` column"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper to specify the dims argument — wb_dims","text":"","code":"# Provide coordinates wb_dims(1, 4) #> [1] \"D1\" wb_dims(rows = 1, cols = 4) #> [1] \"D1\" wb_dims(from_row = 4) #> [1] \"A4\" wb_dims(from_col = 2) #> [1] \"B1\" wb_dims(from_col = \"B\") #> [1] \"B1\" wb_dims(1:4, 6:9, from_row = 5) #> [1] \"F5:I8\" # Provide vectors wb_dims(1:10, c(\"A\", \"B\", \"C\")) #> [1] \"A1:C10\" wb_dims(rows = 1:10, cols = 1:10) #> [1] \"A1:J10\" # provide `from_col` / `from_row` wb_dims(rows = 1:10, cols = c(\"A\", \"B\", \"C\"), from_row = 2) #> [1] \"A2:C11\" wb_dims(rows = 1:10, cols = 1:10, from_col = 2) #> [1] \"B1:K10\" # or objects wb_dims(x = mtcars, col_names = TRUE) #> [1] \"A1:K33\" # select all data wb_dims(x = mtcars, select = \"data\") #> [1] \"A2:K33\" # column names of an object (with the special select = \"col_names\") wb_dims(x = mtcars, select = \"col_names\") #> [1] \"A1:K1\" # dims of the column names of an object wb_dims(x = mtcars, select = \"col_names\", col_names = TRUE) #> [1] \"A1:K1\" ## add formatting to `mtcars` using `wb_dims()`---- wb <- wb_workbook() wb$add_worksheet(\"test wb_dims() with an object\") dims_mtcars_and_col_names <- wb_dims(x = mtcars) wb$add_data(x = mtcars, dims = dims_mtcars_and_col_names) # Put the font as Arial for the data dims_mtcars_data <- wb_dims(x = mtcars, select = \"data\") wb$add_font(dims = dims_mtcars_data, name = \"Arial\") # Style col names as bold using the special `select = \"col_names\"` with `x` provided. dims_column_names <- wb_dims(x = mtcars, select = \"col_names\") wb$add_font(dims = dims_column_names, bold = TRUE, size = 13) # Finally, to add styling to column \"cyl\" (the 4th column) (only the data) # there are many options, but here is the preferred one # if you know the column index, wb_dims(x = mtcars, cols = 4) also works. dims_cyl <- wb_dims(x = mtcars, cols = \"cyl\") wb$add_fill(dims = dims_cyl, color = wb_color(\"pink\")) # Mark a full column as important(with the column name too) wb_dims_vs <- wb_dims(x = mtcars, cols = \"vs\", select = \"x\") wb$add_fill(dims = wb_dims_vs, fill = wb_color(\"yellow\")) wb$add_conditional_formatting(dims = wb_dims(x = mtcars, cols = \"mpg\"), type = \"dataBar\") # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":null,"dir":"Reference","previous_headings":"","what":"Freeze pane of a worksheet — wb_freeze_pane","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"Add Freeze pane worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"","code":"wb_freeze_pane( wb, sheet = current_sheet(), first_active_row = NULL, first_active_col = NULL, first_row = FALSE, first_col = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"wb workbook object sheet name index worksheet first_active_row Top row active region first_active_col Furthest left column active region first_row TRUE, freezes first row (equivalent first_active_row = 2) first_col TRUE, freezes first column (equivalent first_active_col = 2) ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"","code":"## Create a new workbook wb <- wb_workbook(\"Kenshin\") ## Add some worksheets wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_worksheet(\"Sheet 3\") wb$add_worksheet(\"Sheet 4\") ## Freeze Panes wb$freeze_pane(\"Sheet 1\", first_active_row = 5, first_active_col = 3) wb$freeze_pane(\"Sheet 2\", first_col = TRUE) ## shortcut to first_active_col = 2 wb$freeze_pane(3, first_row = TRUE) ## shortcut to first_active_row = 2 wb$freeze_pane(4, first_active_row = 1, first_active_col = \"D\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"List Excel tables in a worksheet — wb_get_tables","title":"List Excel tables in a worksheet — wb_get_tables","text":"List Excel tables worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List Excel tables in a worksheet — wb_get_tables","text":"","code":"wb_get_tables(wb, sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List Excel tables in a worksheet — wb_get_tables","text":"wb workbook object sheet name index worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List Excel tables in a worksheet — wb_get_tables","text":"character vector table names specified sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List Excel tables in a worksheet — wb_get_tables","text":"","code":"wb <- wb_workbook() wb$add_worksheet(sheet = \"Sheet 1\") wb$add_data_table(x = iris) wb$add_data_table(x = mtcars, table_name = \"mtcars\", start_col = 10) wb$get_tables(sheet = \"Sheet 1\") #> tab_name tab_ref #> 1 Table1 A1:E151 #> 2 mtcars J1:T33"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":null,"dir":"Reference","previous_headings":"","what":"Load an existing .xlsx file — wb_load","title":"Load an existing .xlsx file — wb_load","text":"wb_load() returns wbWorkbook object conserving styles formatting original input file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load an existing .xlsx file — wb_load","text":"","code":"wb_load(file, sheet, data_only = FALSE, calc_chain = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load an existing .xlsx file — wb_load","text":"file path existing .xlsx, .xlsm .xlsb file sheet optional sheet parameter. applied, selected sheet loaded. can numeric, string NULL. data_only mode import data frame returned. strips wbWorkbook bare minimum. calc_chain optionally can keep calculation chain intact. used spreadsheet software identify order formulas evaluated. Removing calculation chain considered harmless. calc chain created upon next time worksheet loaded spreadsheet software. Keeping , might speed loading time said software. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load an existing .xlsx file — wb_load","text":"Workbook object.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Load an existing .xlsx file — wb_load","text":"warning displayed xml namespace main found xlsx file. Certain xlsx files created third-party applications contain namespace (usually x). namespace required file work spreadsheet software expected openxlsx2. Therefore removed file loaded workbook. Removal generally expected safe, feature still experimental. Initial support binary openxml files (xlsb) added package. parse binary file format pseudo-openxml files can import. Therefore, importing, possible interact file provided xlsx first place. course slower reading directly binary file. implementation also still missing features: array formulas still broken, conditional formatting data validation implemented, pivot tables slicers. possible import wb_load(data_only = TRUE, sheet = NULL). way workbook skeleton loaded. can useful workbook properties interest.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load an existing .xlsx file — wb_load","text":"","code":"## load existing workbook from package folder wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) wb$get_sheet_names() # list worksheets #> Sheet1 Sheet2 #> \"Sheet1\" \"Sheet2\" wb ## view object #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet1, Sheet2 #> Write order: 1, 2 ## Add a worksheet wb$add_worksheet(\"A new worksheet\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":null,"dir":"Reference","previous_headings":"","what":"Merge cells within a worksheet — wb_merge_cells","title":"Merge cells within a worksheet — wb_merge_cells","text":"Worksheet cell merging","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Merge cells within a worksheet — wb_merge_cells","text":"","code":"wb_merge_cells(wb, sheet = current_sheet(), dims = NULL, solve = FALSE, ...) wb_unmerge_cells(wb, sheet = current_sheet(), dims = NULL, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Merge cells within a worksheet — wb_merge_cells","text":"wb Workbook object sheet name index worksheet dims worksheet cells solve logical intersecting merges solved ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Merge cells within a worksheet — wb_merge_cells","text":"using deprecated arguments rows cols merged region must rectangular, min max cols rows used.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Merge cells within a worksheet — wb_merge_cells","text":"","code":"# Create a new workbook wb <- wb_workbook()$add_worksheet() # Merge cells: Row 2 column C to F (3:6) wb <- wb_merge_cells(wb, dims = \"C3:F6\") # Merge cells:Rows 10 to 20 columns A to J (1:10) wb <- wb_merge_cells(wb, dims = wb_dims(rows = 10:20, cols = 1:10)) wb$add_worksheet() ## Intersecting merges wb <- wb_merge_cells(wb, dims = wb_dims(cols = 1:10, rows = 1)) wb <- wb_merge_cells(wb, dims = wb_dims(cols = 5:10, rows = 2)) wb <- wb_merge_cells(wb, dims = wb_dims(cols = 1:10, rows = 12)) try(wb_merge_cells(wb, dims = \"A1:A10\")) #> Error : Merge intersects with existing merged cells: #> \t\tA1:J1. #> Remove existing merge first. ## remove merged cells # removes any intersecting merges wb <- wb_unmerge_cells(wb, dims = wb_dims(cols = 1, rows = 1)) wb <- wb_merge_cells(wb, dims = \"A1:A10\") # or let us decide how to solve this wb <- wb_merge_cells(wb, dims = \"A1:A10\", solve = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_open.html","id":null,"dir":"Reference","previous_headings":"","what":"Preview a workbook in a spreadsheet software — wb_open","title":"Preview a workbook in a spreadsheet software — wb_open","text":"can also use shorter wb$open() replacement. open xlsx files, see xl_open().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_open.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Preview a workbook in a spreadsheet software — wb_open","text":"","code":"wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_open.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Preview a workbook in a spreadsheet software — wb_open","text":"wb wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":null,"dir":"Reference","previous_headings":"","what":"Order worksheets in a workbook — wb_order","title":"Order worksheets in a workbook — wb_order","text":"Get/set order worksheets Workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Order worksheets in a workbook — wb_order","text":"","code":"wb_get_order(wb) wb_set_order(wb, sheets)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Order worksheets in a workbook — wb_order","text":"wb wbWorkbook object sheets Sheet order","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Order worksheets in a workbook — wb_order","text":"function reorder worksheets within workbook object, simply shuffles order writing file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Order worksheets in a workbook — wb_order","text":"","code":"## setup a workbook with 3 worksheets wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\", gridLines = FALSE) wb$add_data_table(sheet = 1, x = iris) wb$add_worksheet(\"mtcars (Sheet 2)\", gridLines = FALSE) wb$add_data(sheet = 2, x = mtcars) wb$add_worksheet(\"Sheet 3\", gridLines = FALSE) wb$add_data(sheet = 3, x = Formaldehyde) wb_get_order(wb) #> [1] 1 2 3 wb$get_sheet_na #> NULL wb$set_order(c(1, 3, 2)) # switch position of sheets 2 & 3 wb$add_data(2, 'This is still the \"mtcars\" worksheet', startCol = 15) wb_get_order(wb) #> [1] 1 3 2 wb$get_sheet_names() ## ordering within workbook is not changed #> Sheet 1 Sheet 3 mtcars (Sheet 2) #> \"Sheet 1\" \"Sheet 3\" \"mtcars (Sheet 2)\" wb$set_order(3:1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":null,"dir":"Reference","previous_headings":"","what":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"Set page margins, orientation print scaling.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"","code":"wb_page_setup( wb, sheet = current_sheet(), orientation = NULL, scale = 100, left = 0.7, right = 0.7, top = 0.75, bottom = 0.75, header = 0.3, footer = 0.3, fit_to_width = FALSE, fit_to_height = FALSE, paper_size = NULL, print_title_rows = NULL, print_title_cols = NULL, summary_row = NULL, summary_col = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"wb workbook object sheet name index worksheet orientation Page orientation. One \"portrait\" \"landscape\" scale Print scaling. Numeric value 10 400 left, right, top, bottom Page margin inches header, footer Margin inches fit_to_width, fit_to_height TRUE, worksheet scaled fit page width /height printing. paper_size See details. Default value 9 (A4 paper). print_title_rows, print_title_cols Rows / columns repeat top page printing. Integer vector. summary_row Location summary rows groupings. One \"\" \"\". summary_col Location summary columns groupings. One \"Right\" \"Left\". ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"paper_size integer corresponding :","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"S1\") wb$add_worksheet(\"S2\") wb$add_data_table(1, x = iris[1:30, ]) wb$add_data_table(2, x = iris[1:30, ], dims = c(\"C5\")) ## landscape page scaled to 50% wb$page_setup(sheet = 1, orientation = \"landscape\", scale = 50) ## portrait page scales to 300% with 0.5in left and right margins wb$page_setup(sheet = 2, orientation = \"portrait\", scale = 300, left = 0.5, right = 0.5) ## print titles wb$add_worksheet(\"print_title_rows\") wb$add_worksheet(\"print_title_cols\") wb$add_data(\"print_title_rows\", rbind(iris, iris, iris, iris)) wb$add_data(\"print_title_cols\", x = rbind(mtcars, mtcars, mtcars), rowNames = TRUE) wb$page_setup(sheet = \"print_title_rows\", printTitleRows = 1) ## first row wb$page_setup(sheet = \"print_title_cols\", printTitleCols = 1, printTitleRows = 1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":null,"dir":"Reference","previous_headings":"","what":"Protect a workbook from modifications — wb_protect","title":"Protect a workbook from modifications — wb_protect","text":"Protect unprotect workbook modifications user graphical user interface. Replaces existing protection.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Protect a workbook from modifications — wb_protect","text":"","code":"wb_protect( wb, protect = TRUE, password = NULL, lock_structure = FALSE, lock_windows = FALSE, type = 1, file_sharing = FALSE, username = unname(Sys.info()[\"user\"]), read_only_recommended = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Protect a workbook from modifications — wb_protect","text":"wb Workbook object protect Whether protect unprotect sheet (default TRUE) password (optional) password required unprotect workbook lock_structure Whether workbook structure locked lock_windows Whether window position spreadsheet locked type Lock type (see Details) file_sharing Whether enable popup requesting unlock password prompted username username file_sharing popup read_only_recommended Whether post unlock message appears stating workbook recommended opened read-mode. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Protect a workbook from modifications — wb_protect","text":"Lock types: 1 xlsx password (default) 2 xlsx recommends read-4 xlsx enforces read-8 xlsx locked annotation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Protect a workbook from modifications — wb_protect","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"S1\") wb_protect(wb, protect = TRUE, password = \"Password\", lock_structure = TRUE) # Remove the protection wb_protect(wb, protect = FALSE) #> A Workbook object. #> #> Worksheets: #> Sheets: S1 #> Write order: 1 wb <- wb_protect( wb, protect = TRUE, password = \"Password\", lock_structure = TRUE, type = 2L, file_sharing = TRUE, username = \"Test\", read_only_recommended = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Protect a worksheet from modifications — wb_protect_worksheet","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"Protect unprotect worksheet modifications user graphical user interface. Replaces existing protection.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"","code":"wb_protect_worksheet( wb, sheet = current_sheet(), protect = TRUE, password = NULL, properties = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"wb workbook object sheet name index worksheet protect Whether protect unprotect sheet (default=TRUE) password (optional) password required unprotect worksheet properties character vector properties lock. Can one following: \"selectLockedCells\", \"selectUnlockedCells\", \"formatCells\", \"formatColumns\", \"formatRows\", \"insertColumns\", \"insertRows\", \"insertHyperlinks\", \"deleteColumns\", \"deleteRows\", \"sort\", \"autoFilter\", \"pivotTables\", \"objects\", \"scenarios\"","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"S1\") wb$add_data_table(1, x = iris[1:30, ]) wb$protect_worksheet( \"S1\", protect = TRUE, properties = c(\"formatCells\", \"formatColumns\", \"insertColumns\", \"deleteColumns\") ) # Formatting cells / columns is allowed , but inserting / deleting columns is protected: wb$protect_worksheet( \"S1\", protect = TRUE, c(formatCells = FALSE, formatColumns = FALSE, insertColumns = TRUE, deleteColumns = TRUE) ) # Remove the protection wb$protect_worksheet(\"S1\", protect = FALSE) #> A Workbook object. #> #> Worksheets: #> Sheets: S1 #> Write order: 1"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a data table from a worksheet — wb_remove_tables","title":"Remove a data table from a worksheet — wb_remove_tables","text":"Remove Excel tables workbook using name.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a data table from a worksheet — wb_remove_tables","text":"","code":"wb_remove_tables(wb, sheet = current_sheet(), table, remove_data = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a data table from a worksheet — wb_remove_tables","text":"wb Workbook object sheet name index worksheet table Name table remove. Use wb_get_tables() view tables present worksheet. remove_data Default TRUE. FALSE, remove data table attributes keep data worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a data table from a worksheet — wb_remove_tables","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove a data table from a worksheet — wb_remove_tables","text":"","code":"wb <- wb_workbook() wb$add_worksheet(sheet = \"Sheet 1\") wb$add_worksheet(sheet = \"Sheet 2\") wb$add_data_table(sheet = \"Sheet 1\", x = iris, table_name = \"iris\") wb$add_data_table(sheet = 1, x = mtcars, table_name = \"mtcars\", start_col = 10) ## delete worksheet removes table objects wb <- wb_remove_worksheet(wb, sheet = 1) wb$add_data_table(sheet = 1, x = iris, table_name = \"iris\") wb$add_data_table(sheet = 1, x = mtcars, table_name = \"mtcars\", start_col = 10) ## wb_remove_tables() deletes table object and all data wb_get_tables(wb, sheet = 1) #> tab_name tab_ref #> 3 iris A1:E151 #> 4 mtcars J1:T33 wb$remove_tables(sheet = 1, table = \"iris\") wb$add_data_table(sheet = 1, x = iris, table_name = \"iris\") wb_get_tables(wb, sheet = 1) #> tab_name tab_ref #> 4 mtcars J1:T33 #> 5 iris A1:E151 wb$remove_tables(sheet = 1, table = \"iris\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a worksheet from a workbook — wb_remove_worksheet","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"Remove worksheet workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"","code":"wb_remove_worksheet(wb, sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"wb wbWorkbook object sheet sheet name index remove","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"","code":"## load a workbook wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) ## Remove sheet 2 wb <- wb_remove_worksheet(wb, 2)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":null,"dir":"Reference","previous_headings":"","what":"Save a workbook to file — wb_save","title":"Save a workbook to file — wb_save","text":"Save workbook file","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save a workbook to file — wb_save","text":"","code":"wb_save(wb, file = NULL, overwrite = TRUE, path = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save a workbook to file — wb_save","text":"wb wbWorkbook object write file file path save workbook overwrite FALSE, overwrite file already exists. path Deprecated argument. Please use file new code.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Save a workbook to file — wb_save","text":"wbWorkbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save a workbook to file — wb_save","text":"","code":"## Create a new workbook and add a worksheet wb <- wb_workbook(\"Creator of workbook\") wb$add_worksheet(sheet = \"My first worksheet\") ## Save workbook to working directory # \\donttest{ wb_save(wb, file = temp_xlsx(), overwrite = TRUE) # }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the workbook position, size and filter — wb_set_bookview","title":"Set the workbook position, size and filter — wb_set_bookview","text":"Set workbook position, size filter","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the workbook position, size and filter — wb_set_bookview","text":"","code":"wb_set_bookview( wb, active_tab = NULL, auto_filter_date_grouping = NULL, first_sheet = NULL, minimized = NULL, show_horizontal_scroll = NULL, show_sheet_tabs = NULL, show_vertical_scroll = NULL, tab_ratio = NULL, visibility = NULL, window_height = NULL, window_width = NULL, x_window = NULL, y_window = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the workbook position, size and filter — wb_set_bookview","text":"wb wbWorkbook object active_tab activeTab auto_filter_date_grouping autoFilterDateGrouping first_sheet first sheet displayed minimized minimized show_horizontal_scroll showHorizontalScroll show_sheet_tabs showSheetTabs show_vertical_scroll showVerticalScroll tab_ratio tabRatio visibility visibility window_height windowHeight window_width windowWidth x_window xWindow y_window yWindow ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the workbook position, size and filter — wb_set_bookview","text":"Workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"Set worksheet grid lines show hide. can also add / remove grid lines creating worksheet wb_add_worksheet(grid_lines = FALSE)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"","code":"wb_set_grid_lines(wb, sheet = current_sheet(), show = FALSE, print = show) wb_grid_lines(wb, sheet = current_sheet(), show = FALSE, print = show)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"wb workbook object sheet name index worksheet show logical. FALSE, grid lines hidden. print logical. FALSE, grid lines printed.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"","code":"wb <- wb_workbook()$add_worksheet()$add_worksheet() wb$get_sheet_names() ## list worksheets in workbook #> Sheet 1 Sheet 2 #> \"Sheet 1\" \"Sheet 2\" wb$set_grid_lines(1, show = FALSE) wb$set_grid_lines(\"Sheet 2\", show = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":null,"dir":"Reference","previous_headings":"","what":"Set headers and footers of a worksheet — wb_set_header_footer","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"Set document headers footers. can also adding worksheet wb_add_worksheet() header, footer arguments friends. show printing xlsx file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"","code":"wb_set_header_footer( wb, sheet = current_sheet(), header = NULL, footer = NULL, even_header = NULL, even_footer = NULL, first_header = NULL, first_footer = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"wb Workbook object sheet name index worksheet header, even_header, first_header, footer, even_footer, first_footer Character vector length 3 corresponding positions left, center, right. header footer used default additional arguments. Setting even, odd, first, overrides header/footer. Use NA skip position. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"Headers footers can contain special tags &[Page] Page number &[Pages] Number pages &[Date] Current date &[Time] Current time &[Path] File path &[File] File name &[Tab] Worksheet name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"","code":"wb <- wb_workbook() # Add example data wb$add_worksheet(\"S1\")$add_data(x = 1:400) wb$add_worksheet(\"S2\")$add_data(x = 1:400) wb$add_worksheet(\"S3\")$add_data(x = 3:400) wb$add_worksheet(\"S4\")$add_data(x = 3:400) wb$set_header_footer( sheet = \"S1\", header = c(\"ODD HEAD LEFT\", \"ODD HEAD CENTER\", \"ODD HEAD RIGHT\"), footer = c(\"ODD FOOT RIGHT\", \"ODD FOOT CENTER\", \"ODD FOOT RIGHT\"), even_header = c(\"EVEN HEAD LEFT\", \"EVEN HEAD CENTER\", \"EVEN HEAD RIGHT\"), even_footer = c(\"EVEN FOOT RIGHT\", \"EVEN FOOT CENTER\", \"EVEN FOOT RIGHT\"), first_header = c(\"TOP\", \"OF FIRST\", \"PAGE\"), first_footer = c(\"BOTTOM\", \"OF FIRST\", \"PAGE\") ) wb$set_header_footer( sheet = 2, header = c(\"&[Date]\", \"ALL HEAD CENTER 2\", \"&[Page] / &[Pages]\"), footer = c(\"&[Path]&[File]\", NA, \"&[Tab]\"), first_header = c(NA, \"Center Header of First Page\", NA), first_footer = c(NA, \"Center Footer of First Page\", NA) ) wb$set_header_footer( sheet = 3, header = c(\"ALL HEAD LEFT 2\", \"ALL HEAD CENTER 2\", \"ALL HEAD RIGHT 2\"), footer = c(\"ALL FOOT RIGHT 2\", \"ALL FOOT CENTER 2\", \"ALL FOOT RIGHT 2\") ) wb$set_header_footer( sheet = 4, first_header = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\"), first_footer = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify author in the metadata of a workbook — wb_set_last_modified_by","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"Just wrapper wb$set_last_modified_by()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"","code":"wb_set_last_modified_by(wb, name, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"wb workbook object name string object name LastModifiedBy-User ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"","code":"wb <- wb_workbook() wb_set_last_modified_by(wb, \"test\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the default view of a worksheet — wb_set_sheetview","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"helps set worksheet's appearance, zoom, whether show grid lines","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"","code":"wb_set_sheetview( wb, sheet = current_sheet(), color_id = NULL, default_grid_color = NULL, right_to_left = NULL, show_formulas = NULL, show_grid_lines = NULL, show_outline_symbols = NULL, show_row_col_headers = NULL, show_ruler = NULL, show_white_space = NULL, show_zeros = NULL, tab_selected = NULL, top_left_cell = NULL, view = NULL, window_protection = NULL, workbook_view_id = NULL, zoom_scale = NULL, zoom_scale_normal = NULL, zoom_scale_page_layout_view = NULL, zoom_scale_sheet_layout_view = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"wb Workbook object sheet sheet color_id, default_grid_color Integer: color, default 64 right_to_left Logical: TRUE column ordering right left show_formulas Logical: TRUE cell formulas shown show_grid_lines Logical: TRUE worksheet grid shown show_outline_symbols Logical: TRUE outline symbols shown show_row_col_headers Logical: TRUE row column headers shown show_ruler Logical: TRUE ruler shown page layout view show_white_space Logical: TRUE margins shown page layout view show_zeros Logical: FALSE cells containing zero shown blank show_formulas = FALSE tab_selected Integer: zero vector indicating selected tab top_left_cell Cell: cell shown top left corner / top right rightToLeft view View: \"normal\", \"pageBreakPreview\" \"pageLayout\" window_protection Logical: TRUE panes protected workbook_view_id integer: Pointing view inside workbook zoom_scale, zoom_scale_normal, zoom_scale_page_layout_view, zoom_scale_sheet_layout_view Integer: zoom scale 10 400. values current, normal etc. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"","code":"wb <- wb_workbook()$add_worksheet() wb$set_sheetview( zoom_scale = 75, right_to_left = FALSE, show_formulas = TRUE, show_grid_lines = TRUE, show_outline_symbols = FALSE, show_row_col_headers = TRUE, show_ruler = TRUE, show_white_space = FALSE, tab_selected = 1, top_left_cell = \"B1\", view = \"normal\", window_protection = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a data frame from a Workbook — wb_to_df","title":"Create a data frame from a Workbook — wb_to_df","text":"Simple function create data.frame workbook. Simple simply written . read_xlsx() wb_read() just internal wrappers wb_to_df() intended people coming packages.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a data frame from a Workbook — wb_to_df","text":"","code":"wb_to_df( file, sheet, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, skip_hidden_rows = FALSE, skip_hidden_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, na.strings = \"#N/A\", na.numbers = NA, fill_merged_cells = FALSE, dims, show_formula = FALSE, convert = TRUE, types, named_region, keep_attributes = FALSE, ... ) read_xlsx( file, sheet, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, named_region, na.strings = \"#N/A\", na.numbers = NA, fill_merged_cells = FALSE, ... ) wb_read( file, sheet = 1, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, named_region, na.strings = \"NA\", na.numbers = NA, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a data frame from a Workbook — wb_to_df","text":"file xlsx file, wbWorkbook object URL xlsx file. sheet Either sheet name index. missing first sheet workbook selected. start_row first row begin looking data. start_col first column begin looking data. row_names TRUE, first col data used row names. col_names TRUE, first row data used column names. skip_empty_rows TRUE, empty rows skipped. skip_empty_cols TRUE, empty columns skipped. skip_hidden_rows TRUE, hidden rows skipped. skip_hidden_cols TRUE, hidden columns skipped. rows numeric vector specifying rows xlsx file read. NULL, rows read. cols numeric vector specifying columns xlsx file read. NULL, columns read. detect_dates TRUE, attempt recognize dates perform conversion. na.strings character vector strings interpreted NA. Blank cells returned NA. na.numbers numeric vector digits interpreted NA. Blank cells returned NA. fill_merged_cells TRUE, value merged cell given cells within merge. dims Character string type \"A1:B2\" optional dimensions imported. show_formula TRUE, underlying Excel formulas shown. convert TRUE, conversion dates numerics attempted. types named numeric indicating, type data. Names must match returned data. See Details . named_region Character string named_region (defined name table). sheet selected, first appearance selected. See wb_get_named_regions() keep_attributes TRUE additional attributes returned. (used internally define cell type.) ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a data frame from a Workbook — wb_to_df","text":"Depending R package hms loaded, wb_to_df() returns hms variables string variables hh:mm:ss format. types argument must named numeric. 0: character 1: numeric 2: date 3: posixt (datetime) 4: logical read_xlsx() pick formulas added Workbook object via wb_add_formula(). formula written left evaluated file opened spreadsheet software. Opening, saving closing file spreadsheet software resolve .","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a data frame from a Workbook — wb_to_df","text":"","code":"########################################################################### # numerics, dates, missings, bool and string example_file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb1 <- wb_load(example_file) # import workbook wb_to_df(wb1) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # do not convert first row to column names wb_to_df(wb1, col_names = FALSE) #> B C D E F G H I J #> 2 NA Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # do not try to identify dates in the data wb_to_df(wb1, detect_dates = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 45075 3209324 This #DIV/0! 0.06059028 #> 4 TRUE NA NA #NUM! b 45069 0 0.58538194 #> 5 TRUE 2 NA 1.34 c 44958 #VALUE! 0.95905093 #> 6 FALSE 2 NA #NUM! NA 2 0.72561343 #> 7 FALSE 3 NA 1.56 e NA NA #> 8 FALSE 1 NA 1.7 f 44987 2.7 0.36525463 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23 h 45284 25 NA #> 11 FALSE 3 NA 67.3 i 45285 3 NA #> 12 NA 1 NA 123 45138 122 NA # return the underlying Excel formula instead of their values wb_to_df(wb1, show_formula = TRUE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This E3/0 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 C4 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! C6+E6 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 C8+E8 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 SUM(C10,E10) #> 11 FALSE 3 NA 67.3 i 2023-12-25 PRODUCT(C11,E3) #> 12 NA 1 NA 123 2023-07-31 E12-C12 # read dimension without colNames wb_to_df(wb1, dims = \"A2:C5\", col_names = FALSE) #> A B C #> 2 NA NA Var2 #> 3 NA TRUE 1 #> 4 NA TRUE #> 5 NA TRUE 2 # read selected cols wb_to_df(wb1, cols = c(\"A:B\", \"G\")) #> NA Var1 Var5 #> 3 NA TRUE 2023-05-29 #> 4 NA TRUE 2023-05-23 #> 5 NA TRUE 2023-02-01 #> 6 NA FALSE #> 7 NA FALSE #> 8 NA FALSE 2023-03-02 #> 9 NA NA #> 10 NA FALSE 2023-12-24 #> 11 NA FALSE 2023-12-25 #> 12 NA NA 2023-07-31 # read selected rows wb_to_df(wb1, rows = c(2, 4, 6)) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 4 TRUE NA NA #NUM! b 2023-05-23 NA 0 14:02:57 #> 6 FALSE 2 NA #NUM! NA 2 17:24:53 # convert characters to numerics and date (logical too?) wb_to_df(wb1, convert = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 1 123 2023-07-31 122 # erase empty rows from dataset wb_to_df(wb1, skip_empty_rows = TRUE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # erase empty columns from dataset wb_to_df(wb1, skip_empty_cols = TRUE) #> Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 NA 1 123 2023-07-31 122 # convert first row to rownames wb_to_df(wb1, sheet = 2, dims = \"C6:G9\", row_names = TRUE) #> mpg cyl disp hp #> Mazda RX4 21.0 6 160 110 #> Mazda RX4 Wag 21.0 6 160 110 #> Datsun 710 22.8 4 108 93 # define type of the data.frame wb_to_df(wb1, cols = c(2, 5), types = c(\"Var1\" = 0, \"Var3\" = 1)) #> Var1 Var3 #> 3 TRUE 1.00 #> 4 TRUE NaN #> 5 TRUE 1.34 #> 6 FALSE NA #> 7 FALSE 1.56 #> 8 FALSE 1.70 #> 9 NA #> 10 FALSE 23.00 #> 11 FALSE 67.30 #> 12 123.00 # start in row 5 wb_to_df(wb1, start_row = 5, col_names = FALSE) #> B C D E F G H I J #> 5 TRUE 2 NA 1.34 c 2023-02-01 NA #VALUE! 23:01:02 #> 6 FALSE 2 NA NA #NUM! NA 2 17:24:53 #> 7 FALSE 3 NA 1.56 e NA #> 8 FALSE 1 NA 1.70 f 2023-03-02 NA 2.7 08:45:58 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23.00 h 2023-12-24 NA 25 #> 11 FALSE 3 NA 67.30 i 2023-12-25 NA 3 #> 12 NA 1 NA 123.00 2023-07-31 NA 122 # na string wb_to_df(wb1, na.strings = \"a\") #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 ########################################################################### # Named regions file_named_region <- system.file(\"extdata\", \"namedRegions3.xlsx\", package = \"openxlsx2\") wb2 <- wb_load(file_named_region) # read dataset with named_region (returns global first) wb_to_df(wb2, named_region = \"MyRange\", col_names = FALSE) #> A B #> 1 S2A1 S2B1 # read named_region from sheet wb_to_df(wb2, named_region = \"MyRange\", sheet = 4, col_names = FALSE) #> A B #> 1 S3A1 S3B1 # read_xlsx() and wb_read() example_file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") read_xlsx(file = example_file) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 df1 <- wb_read(file = example_file, sheet = 1) df2 <- wb_read(file = example_file, sheet = 1, rows = c(1, 3, 5), cols = 1:3)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Update a data table position in a worksheet — wb_update_table","title":"Update a data table position in a worksheet — wb_update_table","text":"Update position data table, possibly written using wb_add_data_table()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update a data table position in a worksheet — wb_update_table","text":"","code":"wb_update_table(wb, sheet = current_sheet(), dims = \"A1\", tabname)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update a data table position in a worksheet — wb_update_table","text":"wb workbook sheet worksheet dims Cell range used new data table. tabname table name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Update a data table position in a worksheet — wb_update_table","text":"aware function alter filter. Excluding adding rows make rows appear hide .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Update a data table position in a worksheet — wb_update_table","text":"","code":"wb <- wb_workbook()$add_worksheet()$add_data_table(x = mtcars) wb$update_table(tabname = \"Table1\", dims = \"A1:J4\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new Workbook object — wb_workbook","title":"Create a new Workbook object — wb_workbook","text":"Initialize wbWorkbook object. can set workbook properties well.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new Workbook object — wb_workbook","text":"","code":"wb_workbook( creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new Workbook object — wb_workbook","text":"creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords, comments, manager, company Workbook property, string. datetime_created time workbook created theme Optional theme identified string number. See Details options. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a new Workbook object — wb_workbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a new Workbook object — wb_workbook","text":"theme can one \"Atlas\", \"Badge\", \"Berlin\", \"Celestial\", \"Crop\", \"Depth\", \"Droplet\", \"Facet\", \"Feathered\", \"Gallery\", \"Headlines\", \"Integral\", \"Ion\", \"Ion Boardroom\", \"Madison\", \"Main Event\", \"Mesh\", \"Office Theme\", \"Old Office Theme\", \"Organic\", \"Parallax\", \"Parcel\", \"Retrospect\", \"Savon\", \"Slice\", \"Vapor Trail\", \"View\", \"Wisp\", \"Wood Type\"","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a new Workbook object — wb_workbook","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Set Workbook properties wb <- wb_workbook( creator = \"Me\", title = \"Expense Report\", subject = \"Expense Report - 2022 Q1\", category = \"sales\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an object to a worksheet — write_data","title":"Write an object to a worksheet — write_data","text":"Use wb_add_data() write_xlsx() new code.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an object to a worksheet — write_data","text":"","code":"write_data( wb, sheet, x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, col_names = TRUE, row_names = FALSE, with_filter = FALSE, sep = \", \", name = NULL, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an object to a worksheet — write_data","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x Object written. classes supported look examples. dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . array bool function written type array col_names TRUE, column names x written. row_names TRUE, row names x written. with_filter TRUE, add filters column name row. NOTE: can one filter per worksheet. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). name name named region specified. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write an object to a worksheet — write_data","text":"invisible(0)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a worksheet as an Excel table — write_datatable","title":"Write to a worksheet as an Excel table — write_datatable","text":"Write worksheet format Excel table. Use wb_add_data_table() new code. function may exported","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a worksheet as an Excel table — write_datatable","text":"","code":"write_datatable( wb, sheet, x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, col_names = TRUE, row_names = FALSE, table_style = \"TableStyleLight9\", table_name = NULL, with_filter = TRUE, sep = \", \", first_column = FALSE, last_column = FALSE, banded_rows = TRUE, banded_cols = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a worksheet as an Excel table — write_datatable","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x data frame dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . col_names TRUE, column names x written. row_names TRUE, row names x written. table_style table style name \"none\" (see vignette(\"openxlsx2_style_manual\")) table_name Name table workbook. table name must unique. with_filter TRUE, columns filters first row. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). options correspond Excel table options: first_column logical. TRUE, first column bold. last_column logical. TRUE, last column bold. banded_rows logical. TRUE, rows color banded. banded_cols logical. TRUE, columns color banded. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Write to a worksheet as an Excel table — write_datatable","text":"columns x class Date/POSIXt, currency, accounting, hyperlink, percentage automatically styled dates, currency, accounting, hyperlinks, percentages respectively. string \"_openxlsx_NA\" reserved openxlsx2. x contains string, output broken.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_formula.html","id":null,"dir":"Reference","previous_headings":"","what":"Write a character vector as an Excel Formula — write_formula","title":"Write a character vector as an Excel Formula — write_formula","text":"Write character vector containing Excel formula worksheet. Use wb_add_formula() add_formula() new code. function meant internal use.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_formula.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write a character vector as an Excel Formula — write_formula","text":"","code":"write_formula( wb, sheet, x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, cm = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_formula.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write a character vector as an Excel Formula — write_formula","text":"wb Workbook object containing worksheet. sheet worksheet write . (either index name) x formula character vector. dims Spreadsheet dimensions determine x spans: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write . start_row vector specifying starting row write . array bool function written type array cm special kind array function hides curly braces cell. Add , see \"@\" inserted formulas. apply_cell_style write cell styles workbook? remove_cell_style keep cell style? ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":null,"dir":"Reference","previous_headings":"","what":"Write data to an xlsx file — write_xlsx","title":"Write data to an xlsx file — write_xlsx","text":"Write data frame list data frames xlsx file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write data to an xlsx file — write_xlsx","text":"","code":"write_xlsx(x, file, as_table = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write data to an xlsx file — write_xlsx","text":"x object list objects can handled wb_add_data() write file file xlsx file name as_table TRUE, write data table, instead data. ... Arguments passed wb_workbook, wb_add_worksheet, wb_add_data_table, wb_add_data, wb_freeze_pane, wb_set_col_widths, wb_save creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. sheet name new worksheet grid_lines logical. FALSE, worksheet grid lines hidden. tab_color Color sheet tab. wb_color(), valid color (belonging grDevices::colors()) valid hex color beginning \"#\". zoom sheet zoom level, numeric 10 400 percentage. (zoom value smaller 10 default 10.) start_col vector specifying starting column write x . start_row vector specifying starting row write x . col_names TRUE, column names x written. row_names TRUE, row names x written. na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. first_active_row Top row active region first_active_col Furthest left column active region first_row TRUE, freezes first row (equivalent first_active_row = 2) first_col TRUE, freezes first column (equivalent first_active_col = 2) widths Width set cols specified column width \"auto\" automatic sizing. widths recycled length cols. openxlsx2 sets default width 8.43, standard spreadsheet software. See Details general information column widths. overwrite FALSE, overwrite file already exists.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write data to an xlsx file — write_xlsx","text":"workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Write data to an xlsx file — write_xlsx","text":"columns x class Date POSIXt automatically styled dates datetimes respectively.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write data to an xlsx file — write_xlsx","text":"","code":"## write to working directory write_xlsx(iris, file = temp_xlsx(), col_names = TRUE) write_xlsx(iris, file = temp_xlsx(), col_names = TRUE ) ## Lists elements are written to individual worksheets, using list names as sheet names if available l <- list(\"IRIS\" = iris, \"MTCARS\" = mtcars, matrix(runif(1000), ncol = 5)) write_xlsx(l, temp_xlsx(), col_widths = c(NA, \"auto\", \"auto\")) ## different sheets can be given different parameters write_xlsx(l, temp_xlsx(), start_col = c(1, 2, 3), start_row = 2, as_table = c(TRUE, TRUE, FALSE), with_filter = c(TRUE, FALSE, FALSE) ) # specify column widths for multiple sheets write_xlsx(l, temp_xlsx(), col_widths = 20) write_xlsx(l, temp_xlsx(), col_widths = list(100, 200, 300)) write_xlsx(l, temp_xlsx(), col_widths = list(rep(10, 5), rep(8, 11), rep(5, 5)))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":null,"dir":"Reference","previous_headings":"","what":"Open an xlsx file or a wbWorkbook object — xl_open","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"function tries open Microsoft Excel (xls/xlsx) file , wbWorkbook proper application, portable manner. Windows uses base::shell.exec() (Windows function) determine appropriate program. Mac, (c) uses system default handlers, given file type. Linux, searches (via ) available xls/xlsx reader applications (unless options('openxlsx2.excelApp') set app bin path), finds anything, sets options('openxlsx2.excelApp') program chosen user via menu (many present, otherwise set available). Currently searched apps Libreoffice/Openoffice (soffice bin), Gnumeric (gnumeric) Calligra Sheets (calligrasheets).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"","code":"xl_open(x, interactive = NA) # S3 method for wbWorkbook xl_open(x, interactive = NA) # S3 method for default xl_open(x, interactive = NA)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"x path Excel (xls/xlsx) file wbWorkbook object. interactive FALSE throw warning open path. can manually set TRUE, otherwise NA (default) uses value returned base::interactive()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"","code":"# \\donttest{ if (interactive()) { xlsx_file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") xl_open(xlsx_file) # (not yet saved) Workbook example wb <- wb_workbook() x <- mtcars[1:6, ] wb$add_worksheet(\"Cars\") wb$add_data(\"Cars\", x, start_col = 2, start_row = 3, row_names = TRUE) xl_open(wb) } # }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":null,"dir":"Reference","previous_headings":"","what":"append xml child to node — xml_add_child","title":"append xml child to node — xml_add_child","text":"append xml child node","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"append xml child to node — xml_add_child","text":"","code":"xml_add_child(xml_node, xml_child, level, pointer = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"append xml child to node — xml_add_child","text":"xml_node xml_node xml_child xml_child level optional level, missing first child picked pointer pointer ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"append xml child to node — xml_add_child","text":"","code":"xml_node <- \"<\/a>\" xml_child <- \"\" # add child to first level node xml_add_child(xml_node, xml_child) #> [1] \"<\/a>\" # add child to second level node as request xml_node <- xml_add_child(xml_node, xml_child, level = c(\"b\")) # add child to third level node as request xml_node <- xml_add_child(xml_node, \"\", level = c(\"b\", \"c\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":null,"dir":"Reference","previous_headings":"","what":"adds or updates attribute(s) in existing xml node — xml_attr_mod","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"Needs xml node named character vector input. Modifies arguments first child found xml node adds updates attribute vector.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"","code":"xml_attr_mod( xml_content, xml_attributes, escapes = FALSE, declaration = FALSE, remove_empty_attr = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"xml_content valid xml_node xml_attributes R vector named attributes escapes bool escapes used declaration bool declaration imported remove_empty_attr bool remove empty attributes ignore ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"named attribute xml_attributes \"\" remove attribute node. xml_attributes contains named entry found xml node, updated else added attribute.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"","code":"# add single node xml_node <- \"openxlsx2<\/a>\" xml_attr <- c(qux = \"quux\") # \"openxlsx2<\/a>\" xml_attr_mod(xml_node, xml_attr) #> [1] \"openxlsx2<\/a>\" # update node and add node xml_node <- \"openxlsx2<\/a>\" xml_attr <- c(foo = \"baz\", qux = \"quux\") # \"openxlsx2<\/a>\" xml_attr_mod(xml_node, xml_attr) #> [1] \"openxlsx2<\/a>\" # remove node and add node xml_node <- \"openxlsx2<\/a>\" xml_attr <- c(foo = \"\", qux = \"quux\") # \"openxlsx2<\/a>\" xml_attr_mod(xml_node, xml_attr) #> [1] \"openxlsx2<\/a>\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":null,"dir":"Reference","previous_headings":"","what":"create xml_node from R objects — xml_node_create","title":"create xml_node from R objects — xml_node_create","text":"takes xml_name, xml_children xml_attributes create new xml_node.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create xml_node from R objects — xml_node_create","text":"","code":"xml_node_create( xml_name, xml_children = NULL, xml_attributes = NULL, escapes = FALSE, declaration = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create xml_node from R objects — xml_node_create","text":"xml_name name new xml_node xml_children character vector children attached xml_node xml_attributes named character vector attributes xml_node escapes bool escapes used declaration bool declaration imported","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"create xml_node from R objects — xml_node_create","text":"xml_children xml_attributes empty, use NULL","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create xml_node from R objects — xml_node_create","text":"","code":"xml_name <- \"a\" # \"\" xml_node_create(xml_name) #> [1] \"\" xml_child <- \"openxlsx\" # \"openxlsx<\/a>\" xml_node_create(xml_name, xml_children = xml_child) #> [1] \"openxlsx<\/a>\" xml_attr <- c(foo = \"baz\", qux = \"quux\") # \"\" xml_node_create(xml_name, xml_attributes = xml_attr) #> [1] \"\" # \"openxlsx<\/a>\" xml_node_create(xml_name, xml_children = xml_child, xml_attributes = xml_attr) #> [1] \"openxlsx<\/a>\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":null,"dir":"Reference","previous_headings":"","what":"remove xml child to node — xml_rm_child","title":"remove xml child to node — xml_rm_child","text":"remove xml child node","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"remove xml child to node — xml_rm_child","text":"","code":"xml_rm_child(xml_node, xml_child, level, which = 0, pointer = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"remove xml child to node — xml_rm_child","text":"xml_node xml_node xml_child xml_child level optional level, missing first child picked optional index node remove, multiple available. Default disabled removed pointer pointer ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"remove xml child to node — xml_rm_child","text":"","code":"xml_node <- \"<\/c><\/b><\/a>\" xml_child <- \"c\" xml_rm_child(xml_node, xml_child) #> [1] \"<\/c><\/b><\/a>\" xml_rm_child(xml_node, xml_child, level = c(\"b\")) #> [1] \"<\/a>\" xml_rm_child(xml_node, \"d\", level = c(\"b\", \"c\")) #> [1] \"<\/b><\/a>\""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-development-version","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 (development version)","text":"Add new params wb_add_pivot_table(). now possible set show_data_as value set tabular table design. 833","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-development-version","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 (development version)","text":"Previously formulas written data frames xml escaped. 834 Improve drawing relationship id selection cause issues unordered relationship ids loaded workbooks. 838 Improve copying cells transpose mode hyperlinks. 850 Options openxlsx2.maxWidth openxlsx2.minWidth now respected documented setting column widths wb_set_col_widths(). 847","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-11","dir":"Changelog","previous_headings":"","what":"openxlsx2 1.1","title":"openxlsx2 1.1","text":"CRAN release: 2023-10-23","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-1-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 1.1","text":"Basic support cloning worksheets across workbooks added wb_clone_worksheet(). work tabular formula data, images charts. Support complex worksheets known pending. 622 Enable loading workbooks without sheets wb_load(sheet = NULL). helpful sheets contain lot data general workbook data interest. 810 longer needed manually create columns wb_group_cols(). 781 now possible sort pivot tables created wb_add_pivot_table(). 795 Basic support xlsb file format. parse binary file format pseudo-openxml files can import. Therefore, importing, possible interact file provided xlsx first place. course slower reading directly binary file. implementation also still missing features: array formulas still broken, conditional formatting data validation implemented, pivot tables slicers. 688 Please note openxlsx2 security tool xlsb parser written intention reading valid xlsb files little endian systems. Please raise issues xlsb terms speed completeness features openxml standard. access file conversion tools, spreadsheet software, may provide better solution needs. Writing xlsb files outside scope project. New set function wb_get_properties()/wb_set_properties() view modify workbook properties. 782 subsequently improved handle workbook properties like company manager. (799, @olivroy) Basic (experimental) support add slicers pivot tables created openxlsx2. 822","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-1-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 1.1","text":"Removing worksheet active tab longer result warnings spreadsheet software. 792 update_table() works now without table autofilter. 802","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-10","dir":"Changelog","previous_headings":"","what":"openxlsx2 1.0","title":"openxlsx2 1.0","text":"CRAN release: 2023-08-25","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-1-0","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 1.0","text":"Use wb_get_sheet_names(), wb_get_active_sheet(), wb_get_selected() instead. wbChartSheet now internal (760, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"deprecated-functions-1-0","dir":"Changelog","previous_headings":"","what":"Deprecated functions","title":"openxlsx2 1.0","text":"functions longer recommended. guide created help users continue work time, changing newer functions recommended. delete_data() deprecated favor wb_remove_tables() wb_clean_sheet() create_comment() deprecated favor wb_comment(). Note wb_comment() new defaults, behavior create_comment() changed. (758, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-1-0","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 1.0","text":"wb_comment() new helper function help create wbComment objects similar create_comment(), following differences: author looks options(\"openxlsx2.creator\"); (create_comment() used sys.getenv(\"USERNAME\") / Sys.getenv(\"USER\")) visible defaults FALSE account modern spreadsheet software behavior. (create_comment(), TRUE). width height must now length 1. (create_comment(), first element taken, ignored.) wb_get_sheet_names() gains escape argument allow special XML characters escaped. 252 wb_color() now accepts hex colors leading sharp (e.g. “#FFFFF”) 728. wb_merge_cells() gains solve argument. allows solve cell intersecting regions. 733 wb_add_comment(comment = \"x\") longer errors comment character vector longer fails (758, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"documentation-improvement-1-0","dir":"Changelog","previous_headings":"","what":"Documentation improvement","title":"openxlsx2 1.0","text":"Tweaks documentation vignettes make consistent.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-1-0","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 1.0","text":"wb_to_df() now handles date1904 detection. Previous results somewhat rare file type using default timezone origin 1900-01-01. 737 workbooks threaded comments 731 workbooks embeddings docx 732 workbooks long hyperlinks 753 wb_load() adds path wbWorkbook object. 741 wb_set_header_footer() now works special characters 747","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-1-0","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 1.0","text":"wb_get_active_sheet(), wb_set_active_sheet(), wb_get_selected() wb_set_selected(), wb_get_named_regions() now wrapper functions. 735","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-08","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.8","title":"openxlsx2 0.8","text":"CRAN release: 2023-08-07","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"api-change-0-8","dir":"Changelog","previous_headings":"","what":"API Change","title":"openxlsx2 0.8","text":"Function arguments now defaulting snake_case. time , arguments accepted camelCase switched snake_case hood. examples currently still displaying camelCase maybe camelCase function slipped . 678 write_formula(), write_data(), write_datatable(), write_comment() longer recommended, Use wb_add_formula(), wb_add_data(), wb_add_data_table(), wb_add_comment() instead.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-8","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.8","text":"Order arguments wb_add_named_region() changed, previously overlooked dims argument added. various functions order dims changed, highlight ’s importance Cleanups remove deprecated functions remove deprecated arguments xy argument arguments col, row, cols, rows. start_col, start_row gridExpand deprecated favor dims. Row column vectors can converted dims using wb_dims(). xlsx_file favor file wb_to_df() deprecating function convertToExcelDate() convert_to_excel_date() wb_grid_lines() wb_set_grid_lines() make get_cell_refs(), get_date_origin(), guess_col_type(), write_file(), dataframe_to_dims(), dims_to_dataframe(), wb_get_sheet_name() internal functions make classes styles_mgr(), wbSheetData, wbWorksheet, wbComment, wbHyperlink internal","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-8","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.8","text":"wb_dims(1:5, letters) wb_dims(1:5, 1:26) wb_dims(x = matrix(1, 5, 26)) wb_dims(x = mtcars, from_col = \"C\", from_row = 2, row_names = TRUE) Handling thread comments now possible via wb_add_thread(). includes options reply resolve comments.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-8","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.8","text":"Improve show_formula. Previously called early function skipped cases. 715","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"refactoring-0-8","dir":"Changelog","previous_headings":"","what":"Refactoring","title":"openxlsx2 0.8","text":"Cleanup / revisit documentation vignettes (682, @olivroy) function index improved. (717, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-071","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.7.1","title":"openxlsx2 0.7.1","text":"CRAN release: 2023-06-30","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-7-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.7.1","text":"now possible apply specific theme workbook. 630 Removed former example files updated code use new default example. changes internal testing run locally online external files required. reduces package footprint little, 1MB xlsx files now excluded. 632 handling fmt_txt() objects improved. now creates objects class fmt_txt print(), +, .character() methods. objects can now also used text create_comment(). 636 Improve support inputs labels attribute. e.g. factor label numeric, now try write label number. impact way partially labeled variables written. 639 Added new wrapper function wb_add_named_style() supports pre-defined theme aware cell styles like Title Note. addition loading cell styles improved additional custom cell styles available well. 628 Provide additional options write special characters non-unicode environments. 641 Add wb_add_dxfs_style() single line wrapper create dxf styles used conditional formatting custom table styles. 665","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-7-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.7.1","text":"load app.xml now assigned wb$app. Previously loaded assigned. 629 Previously wb_to_df() used argument cols, columns missing created end output frame. Now columns returned ordered. 631 Fix bug wb_load() modifying cell range conditional formatting. 647","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-7-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.7.1","text":"Order arguments wb_add_conditional_formatting() changed, previously overlooked dims argument added. 642 New argument gradientFill added create_dxfs_style(). 651 Special characters now escaped conditional formatting. Hence, previously manually escaped conditional formatting needs updates. 666","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-07","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.7","title":"openxlsx2 0.7","text":"CRAN release: 2023-05-26","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-7","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.7","text":"dims argument wb_add_formula() can used create array references. new cm argument added might useful, formulas previously created addition @ spreadsheet software. Examples use formulas added new vignette. 593 Allow using custom data table styles. fixes minor style inconsistencies. 594 Allow reading writing hms columns. 601 Import tableStyles wb_load() improve dxf style creation. 603 Add fmt_txt() style character strings. 607 Add new wrapper ignore worksheet errors wb_add_ignore_error(). 617 Add new wrapper update table references wb_update_table(). 606","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-7","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.7","text":"Improve handling non standard OutDec options. 611 openxlsx2 now better job trying return character values classes foreign . going quite time, although previously bug treated classes numeric, resulting corrupted xlsx files. 615 now return additional xml arguments worksheets. 617","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-061","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.6.1","title":"openxlsx2 0.6.1","text":"CRAN release: 2023-04-21","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-6-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.6.1","text":"Improve col2int() accept column ranges like col2int(\":Z\"). allow using column ranges various places like wb_merge_cells(cols = \"B:D\", ...) wb_read(cols = c(\"\",\"C:D\")). 575 Add dims argument wb_add_image() wb_add_plot(). can used place images starting cell span cell range. deprecates xy wb_add_plot(). adds colOffset rowOffset wb_add_drawing() wb_add_mschart() wb_add_chart_xml(). 578 Add skipHiddenCols skipHiddenRows wb_to_df(). way, hidden columns rows ignored, assuming person hidden assumes important. 579 writing tibble use .data.frame() just like data.table case. 582 Add cleanup internal comment code write_comment(). impact workbook wrapper code wb_add_comment(). 586 Added chain functions wb_to_df() wb_load(). 587","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-06","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.6","title":"openxlsx2 0.6","text":"CRAN release: 2023-04-02","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-6","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.6","text":"Styles arguments now accept logical numeric arguments applicable. 558 Adding dims argument wb_clean_sheet(). allows clean selected range. 563","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-6","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.6","text":"na.strings = NULL longer ignored write_xlsx() 552 Explicit type conversion date datetime finally available. 551","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-6","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.6","text":"skipEmptyCols skipEmptyRows behavior wb_to_df() related functions switched include empty columns name. Previously exclude columns empty, even name. 555 Cleanups 548 cloneSheetStyle() get_cell_style() set_cell_style() wb_conditional_formatting() xy argument write_data_table() interacting functions file xl_open() definedName wb_to_df() interacting functions get_named_regions() wb_get_named_regions()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-051","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.5.1","title":"openxlsx2 0.5.1","text":"CRAN release: 2023-02-26","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-5-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.5.1","text":"Allow hierarchical grouping. wb_group_cols/wb_group_rows now accept nested lists grouping variable. 537 now possible add form control types Checkbox, Radio Drop workbook using wb_add_form_control(). 533 Improve wb_to_df(fillMergedCells = TRUE) work better dimensions. now possible fill cells merged cells intersect selected dimensions. 541 Speedup cell initialization. used wb_style functions like wb_add_numfmt(). previous loop replaced faster implementation. 545 Improve date detection wb_to_df(). improves date posix detection custom date formats. 547 na_strings() now used explicit default value na.strings parameters exported workbook functions. 473 waiver functions (.e., next_worksheet(), current_worksheet(), na_strings()) now exports 474","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-5-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.5.1","text":"Fixed bug loading input multiple sheets every sheet contains drawing/comment. Previously assumed every sheet comment ordered incorrectly. caused confusion spreadsheet software. 536 Fixed bug files containing 10 external references. case load references numeric order instead “1.xml”, “10.xml”, …, “2.xml”, … jumbled external references. 538","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-05","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.5","title":"openxlsx2 0.5","text":"CRAN release: 2023-01-29","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-5","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.5","text":"Improve column row grouping. now possible group list, can create various levels groupings. 486 writeData() calls force(x) evaluate object options set (#264) tabColor wb_add_worksheet() now allows passing wb_color(). 500 Add wb_copy_cells() wrapper allows copying cell ranges workbook direct copy, reference value. 515 Experimental option: openxlsx2.string_nums write string numerics differently. string numeric numeric string like: .character(1.5). option can 0 = current default. Writes string numeric string (incorrect way according spreadsheet software) 1 = writes string numeric numeric character flag (correct way according spreadsheet software) 2 = convert string numeric numeric writing experimental, impact somewhat unknown. might trigger unintended side effects. Feedback requested. Enable writing strings sharedStrings argument inline_strings = FALSE. creates sharedStrings table openxml allows reuse strings workbook efficiently can reduce file size workbook many cells duplicates. 499 Initial implementation wb_add_pivot_table(). allows adding native pivot tables openxlsx2 workbooks. pivot table area remain empty sheet opened spreadsheet software evaluated successfully. feature newly developed can cause unexpected side effects. aware using might currently break workbooks.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-5","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.5","text":"Reading files frozen panes one section node restored. 495 Fixed copy paste mistake add_border() used left borders right borders. 496 Improve XML unescaping. 497 Fix reading saving workbooks multiple slicers per sheet. 505 Fix tab selection always selecting first sheet since #303. 506","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-5","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.5","text":"export write_data2() anymore. used development early stages package used directly anymore. documentation: openxlsx2 defaults American English ‘color’ now . Though, fully support previous ‘colour’. Users adjust code. documentation lists color, can pass colour just way used . 501 502","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-041","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.4.1","title":"openxlsx2 0.4.1","text":"CRAN release: 2022-12-18","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-4-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.4.1","text":"Provide new argument calc_chain wb_load(). set FALSE per default, ignore calculation chain found. change reflects files imported third party spreadsheet software visible user. 461 Tweaks wb_data(). Dims now optional select data similar wb_to_df(), similar allows passing wb_to_df() arguments. Though, probably good idea creative passing arguments, result usable wb_data object. 462 Add hidden argument change default heights NULL set_row_heights(). allows changing row height /hiding selected rows. yet provide way hide rows per default. 475 Add wb_add_chartsheet() chart sheet support. Along internal cleanup around chart sheet code. 466","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-4-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.4.1","text":"Fix wb_freeze_pane(). changes load logic bit. Previously put everything sheetViews (frozen pane part ). Though wb_freeze_pane() assumes freezePane used. now try smart split sheetViews upon loading. 465 Previously, adding mschart objects sheets possible (1) worksheet already contained drawing (workbook loaded) (2) last sheet workbook. now fixed. Adding mschart objects worksheet workbook now possible intended. 458 Really fix double xml escaping saving. 467 Improving drawing logic. workbooks various drawings per sheet previously combinations possible reflecting . 478","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-04","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.4","title":"openxlsx2 0.4","text":"CRAN release: 2022-12-05","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-4","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.4","text":"Provide rvg support via wb_add_drawing(). allows integrating rvg plots xlsx files. 449 Improve print options. Defaults printing grid lines, worksheet contains grid lines. 440 Support reading files form control. 426 Handle input files chart extensions. 443 Improve writing styles workbook. Previously every cell checked, changed check unique styles. 423 Implement reading custom file properties. 418 Improved add_named_region(). function includes now various xml options. 386 Add … argument read_xlsx() wb_read(). 381 Allow reading files xml namespace created third party software. 405","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-4","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.4","text":"Update remove calculation chain overwriting formulas workbook. 438 Fix double xml escaping saving. 435 Minor tweak POSIXct dates try avoid notorious 29Feb1900. 424 Implement reading customXml folder input files connection. 419 Fixed saving files tag. Previously wrapped second sheetPr node. issue occurs xlsm files . 417 Fixed case embedded files assigned incorrectly worksheet relationships. caused corrupted output. 403","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-4","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.4","text":"Remove merge_ functions styles. 450 Previously loaded workbook contained formulas pointing cells modified openxlsx2, formulas updated, workbook opened spreadsheet software. now enforced, unless option openxlsx2.disableFullCalcOnLoad set. case respect original calculation properties workbook. wb_save() longer returns path object saved , instead wbWorkbook object, invisibly. consistent behavior others wrappers. 378 Remove never used .equal.wbWorkbook(). idea nice, never developed something useful. Remove never used wb_chart_sheet() function. 399","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-4","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.4","text":"Provide set_sheetview() sheets. Can used provide wbWorkbook function wrapper future. 399","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-031","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.3.1","title":"openxlsx2 0.3.1","text":"CRAN release: 2022-10-31","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-3-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.3.1","text":"Functions adding data workbook now bring applyCellStyle argument. TRUE openxlsx2 apply numeric style, FALSE simply add numeric value without additional styling use previous cell style. 365 Reading file workbook showFormula now returns formulas found workbook. Previously type e str returned. Now able see formulas like hyperlinks . 352","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.3.1","text":"Moved data validation list x14 data validation. enables data validation lists without x14 extension openxlsx 386. 347 Removed build_cell_merges() replaced plain R solution. 390","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-3-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.3.1","text":"Improvements setting column widths. Previously values set set_col_widths() little . now improved. still corner cases column width set openxlsx2 match shown spreadsheet software. Notable differences can seen floating point values (e.g., 10L works 10.1 slightly ) column width Mac. 350 Improve rowNames writing data worksheet. Previously name rownames column defaulted 1. changed. Now data defaults empty cell data table defaults _rowNames_. 375 Fix workbook xml relationship file include reference shared strings per default. solves 360 plain data files written openxlsx2. 363 Adding cell styles streamlined increase consistency. includes style functions like wb_add_font() covers cases hyperlinks. 365 Fix cloning pivot charts. 361 Fix loading writing files slicers. Loading add empty slicer xml files Content_Types workbook.xml.rels. 361 Align logic writing data empty worksheets updating/writing worksheets data. removes update_cell_loop() changes update_cell() behaves. remove duplicated code, also brings great speed improvements (issue 356). 356 now possible use special characters formulas without coding. Previously & encoded like & 251","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.3.1","text":"Previously deprecated names.wbWorkbook() names<-.wbWorkbook() removed. 367 Conditional style defaults create_dxfs_style() changed permissive. Previously shipped default font, default font size font color. changed better reflect behavior user expects. 343","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-03","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.3","title":"openxlsx2 0.3","text":"CRAN release: 2022-09-30","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-3","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.3","text":"New argument startCol read data frame functions wb_to_df(), wb_read() read_xlsx(). 330 New function wb_colour() ease working color vectors used openxlsx2 styles. 292 Deprecated get_cell_style() set_cell_style() favor newly introduced wrapper functions wb_get_cell_style() wb_set_cell_style(). 306 Improvements wb_clone_worksheet(). Cloning chartsheets well worksheets containing charts, pivot tables, drawings tables now possible tweaked. Slicers removed cloned worksheet. 305 Allow writing class data.table. 313 Provide na.numbers reading functions, convert numbers NA R output. Handle na.strings write_xlsx(). 301 Add new option add sparklines various style options worksheets: wb_add_sparklines(). Sparklines can created create_sparklines(). manual page contains example. 280 Add new options data validation. allow type custom, add arguments errorStyle, errorTitle, error, promptTitle, prompt. 271 Provide wb_clone_sheet_style(). improves upon now deprecatedcloneSheetStyle() existed early draft. 233 wb$add_data() now checks earlier missing x argument. 246","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-3","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.3","text":"Worksheets added wbWorkbook longer contain default references drawings vmlDrawings directories. Previously, references added rId1 rId2 even worksheet contain drawing (e.g., image chart) vml drawing (e.g., comment button). cases certain third party software, strictly following references worksheet Content_Types complained missing files import files failed completely. 311 Implement loading user defined chartShapes. Previously implemented instead previous logic assumed every sheet matching drawing. chartShapes longer true. number drawings number worksheets/chartsheets must match. 323 loading files charts, now imported wbWorkbook object. Previously simply copied. allow easier interaction charts future. 304 Moving data validation code workbook worksheet. Also, data_validation_list() longer stored dataValidationLst. moved extLst, fixing bug saving adding another data validation list. code retrieving date origin workbook improved get_date_origin(wb, origin = TRUE) now returns origin integer wbWorkbook. 299 Removed level4 XML functions. single use case level4 function solved differently. level4 needed, can solved using level3 additional level2 functions. addition xml_nodes now return nodes reachable nestings, therefore xml_node(\"<\/><\/>\", \"\") now return character vector length two. xml_node(\"<\/>\", \"\") single character vector returned. 280 Changes various internal pugixml functions, improve handling XML strings. 279 Provide internal helper xml_rm_child() remove children XML strings. 273 Fixes bug update_cell() slowed writing worksheets data. addition, function cleaned improved. longer exported, users need use wb_add_data() write_data(), calls update_cell() hood. 275 276 Various (mostly internal) changes conditional_formatting. Created style_mgr integration dxf (cf-styles) cleaned internal code. syntax changed slightly, see conditional formatting vignette reference. Add whitespace argument read_xml(). 268","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-3","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.3","text":"Order arguments reading functions wb_to_df(), wb_read() read_xls() changed.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-2-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.2.1","text":"Data adding functions now ship dims argument can used determine startCol startRow x object added worksheet. Works add_data(), add_data_table(), add_formula() underlying write_ functions well wrappers. Provide optional na.strings argument writing data sheets. can used add custom character string writing numeric data. Improve writing NA, NaN, -Inf/Inf. NA converted #N/; NaN converted #VALUE!; Inf converted #NUM!. conversion applied reading workbook. 256 Many wbWorkbook methods now contain default sheet values current_sheet() next_sheet() (e.g., $add_worksheet(sheet = next_sheet()), $write_data(sheet = curret_sheet()). internal waiver functions allow wbWorkbook object use default expectations sheet interact . allows easier workflow wb$add_worksheet()$add_data(x = data.frame()) $add_worksheet() knows add new worksheet (default name), sets new worksheet current worksheet, $add_data() picks new sheet places data . 165, 179 New functions wb_add_cell_style() wb$add_cell_style() simplify creation cell styles cells sheet. provides fast way create cell styles regions worksheet. cells cell format created must already exist worksheet. cells already contain cell format, preserved, except updated cell format entries, always created. function applied continuous cell worksheet. 230 New functions wb_add_numfmt() wb$add_numfmt() simplify creation number formats cells sheet. provides fast way create number formats regions worksheet. cells number format created must already exist worksheet. cells already contain cell style, preserved, except number format, always created. function applied continuous cell worksheet. 229 New functions wb_add_font() wb$add_font() simplify creation fonts cells sheet. provides fast way create fonts regions worksheet. cells font created must already exist worksheet. cells already contain cell style, preserved, except font, always created. function applied continuous cell worksheet. 228 New functions wb_add_fill() wb$add_fill() simplify creation fills cells sheet. provides fast way create color filled regions worksheet. cells fill created must already exist worksheet. cells already contain cell style, preserved, except filled color, always created. function applied continuous cell worksheet allows change color every n-th column row. 222 New functions wb_add_border() wb$add_border() simplify creation borders cells sheet. especially useful creating surrounding borders different border styles various cells. cells border created must already exist worksheet. cells already contain cell style, preserved, except border, always created. function applied continuous cell worksheet allows change horizontal vertical internal border grid independently. 220 Enable reading tables wb_to_df(). Tables handled similar defined names. 193 Several enhancements added checking validation worksheet names 165 adding new worksheet via wbWorkbook$add_worksheet() provided name checked illegal characters (see note Breaking changes) wbWorkbook$get_sheet_names() (wb_get_sheet_names() wrapper) added. return formatted original sheet names make names.wbWorkbook() names<-.wbWorkbook() deprecated wbWorkbook$setSheetName() deprecated clean_worksheet_names() added support removing characters allowed worksheet names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-2-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.2.1","text":"Various fixes enable handling non unicode R environments 243 Fix issue broken pageSetup reference causing corrupt excel files 216 Fix reading writing comments workbooks already provide comments 209 Fix issue broken xml Excels vml files enable opening xlsm files wb$open() 202 Fix reading writing non UTF-8 systems 198 199 207 Instruct parser import nodes whitespaces. fixes complaint spreadsheet software. 189 Fix reading file without row attribute. 187 190 Remove reference printerSettings.bin loading. binary blob included reference caused file corruption warnings. 185 Fix loading writing xlsx files workbook$extLst. Previously loaded sheet contains slicer, second extLst added confused spreadsheet software. Now combined single node. Fix writing xlsx file multiple entries conditional formatting type databar sheet. 174 Cell fields cm, ph vm now implemented reading writing. first step handle functions use metadata. 173 wbWorkbook: $open() longer overwrites $path field temporary file 171 xl_open() works (better) Windows 170","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-2-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.2.1","text":"writing existing workbooks, default value removeCellStyle now FALSE. Therefore cell contains style, attempted replace value, style cell . wb_conditional_formatting() deprecated favor wb_add_conditional_formatting() wbWorkbook$add_conditional_formatting(). type must now match exactly one : \"expression\", \"colorScale\", \"dataBar\", \"duplicatedValues\", \"containsText\", \"notContainsText\", \"beginsWith\", \"endsWith\", \"\", \"topN\", \"bottomN\" Assigning new worksheet illegal character now prompts error 165. See ?clean_worksheet_name easy method replacing bad characters. openxlsx2Coerce() (called x objects adding data workbook) removed. Users can longer pass arbitrary objects need format objects appropriately rely .data.frame methods 167 xl_open(file = ) longer valid throw warning; first argument changes x highlight xl_open() can called file path wbWorkbook object 171","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-2-1","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.2.1","text":"Remove wb$createFontNode() never used. Switch modern xlsx template, creating workbooks. Imported workbooks use imported template Rewrite wb$tables use data frame approach. simplifies code bit makes easier implement upcoming changes 191 Update internal pugixml library two functions write_data() write_datatable() now use internal function write_data_table() add data sheet. simplifies code ensures functions tested. pull request, documentation updated stack= option, present , removed 175 wbWorkbook$validate_sheet() added object methods private wbWorkbook field original_sheet_names added track original names passed sheets private $get_sheet() removed favor explicit private wbWorkbook methods additions: $get_sheet_id_max(), $get_sheet_index() getting ids $get_sheet_name() getting sheet name $set_single_sheet_name() setting sheet names $pappend() general private appending $validate_new_sheet() checking new sheet names $append_workbook_field() self$workbook[[field]] $append_sheet_rels() self$worksheet_rels[[sheet]] $get_worksheet() replace $ws()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-020","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.2.0","title":"openxlsx2 0.2.0","text":"Added NEWS.md file track changes package. First public release","code":""}] +[{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"basic-read-and-write-functions","dir":"Articles","previous_headings":"","what":"Basic read and write functions","title":"Upgrade from openxlsx","text":"Welcome openxlsx2 update vignette. vignette take common code examples openxlsx show similar results can replicated openxlsx2. Thank taking look, let’s get started. previous openxlsx functions used . function calls, well camelCase, tried switch snake_case (still work progress, may still function arguments use camelCase).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"read-xlsx-or-xlsm-files","dir":"Articles","previous_headings":"Basic read and write functions","what":"Read xlsx or xlsm files","title":"Upgrade from openxlsx","text":"basic read function changed read.xlsx read_xlsx. Using default xlsx file included package: old syntax looked like : changed : can see, return spreadsheet return codes (e.g., #NUM) openxlsx2. Another thing see , return cell row rowname data frame returned. openxlsx2 return data frame selected size, even empty. preferred openxlsx::readWorkbook() become wb_read(). wrappers newly introduced function wb_to_df() provides options. read_xlsx() wb_read() created backward comparability.","code":"file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") # read in openxlsx openxlsx::read.xlsx(xlsxFile = file) # read in openxlsx2 openxlsx2::read_xlsx(file = file) ## Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 ## 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 ## 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 ## 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 ## 6 FALSE 2 NA #NUM! 2 17:24:53 ## 7 FALSE 3 NA 1.56 e ## 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 ## 9 NA NA NA ## 10 FALSE 2 NA 23 h 2023-12-24 25 ## 11 FALSE 3 NA 67.3 i 2023-12-25 3 ## 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"write-xlsx-files","dir":"Articles","previous_headings":"","what":"Write xlsx files","title":"Upgrade from openxlsx","text":"Basic writing openxlsx2 behaves identical openxlsx. Though aware overwrite optional parameter openxlsx2 just like functions like base::write.csv() write onto existing file name, file replaced. Setting output temporary xlsx file previous write function looks like : new function looks quite similar:","code":"output <- temp_xlsx() # write in openxlsx openxlsx::write.xlsx(iris, file = output, colNames = TRUE) # write in openxlsx2 openxlsx2::write_xlsx(iris, file = output, col_names = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"basic-workbook-functions","dir":"Articles","previous_headings":"","what":"Basic workbook functions","title":"Upgrade from openxlsx","text":"Workbook functions renamed begin wb_ plenty package, therefore looking man pages seems fastest way. Yet, begins loading workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"loading-a-workbook","dir":"Articles","previous_headings":"Basic workbook functions","what":"Loading a workbook","title":"Upgrade from openxlsx","text":"major feature openxlsx workbooks. Obviously remain central piece openxlsx2. Previous load : openxlsx2 loading changed : plenty functions interact workbooks describe every single one . detailed list can found references","code":"wb <- openxlsx::loadWorkbook(file = file) wb <- wb_load(file = file)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"styles","dir":"Articles","previous_headings":"Basic workbook functions","what":"Styles","title":"Upgrade from openxlsx","text":"One biggest user facing change removal stylesObject. following section use code openxlsx::addStyle() openxlsx2 code looks something like : code uses chaining. prefer piping, provide chained functions prefix wb_ wb_add_worksheet(), wb_add_data(), wb_add_border() wb_set_col_widths() functions use pipes %>% |>. pipes code becomes aware chains modify object place pipes . can re-use styles wb_get_cell_style() wb_set_cell_style(). Abandoning stylesObject openxlsx2 huge benefit can import export spreadsheet without changing cell style. still possible modify cell style wb_add_border(), wb_add_fill(), wb_add_font() wb_add_numfmt(). Additional examples regarding styles can found styles vignette.","code":"# openxlsx ## Create a new workbook wb <- createWorkbook(creator = \"My name here\") addWorksheet(wb, \"Expenditure\", gridLines = FALSE) writeData(wb, sheet = 1, USPersonalExpenditure, rowNames = TRUE) ## style for body bodyStyle <- createStyle(border = \"TopBottom\", borderColor = \"#4F81BD\") addStyle(wb, sheet = 1, bodyStyle, rows = 2:6, cols = 1:6, gridExpand = TRUE) ## set column width for row names column setColWidths(wb, 1, cols = 1, widths = 21) # openxlsx2 chained border_color <- wb_color(hex = \"4F81BD\") wb <- wb_workbook(creator = \"My name here\")$ add_worksheet(\"Expenditure\", grid_lines = FALSE)$ add_data(x = USPersonalExpenditure, row_names = TRUE)$ add_border( # add the outer and inner border dims = \"A1:F6\", top_border = \"thin\", top_color = border_color, bottom_border = \"thin\", bottom_color = border_color, inner_hgrid = \"thin\", inner_hcolor = border_color, left_border = \"\", right_border = \"\" )$ set_col_widths( # set column width cols = 1:6, widths = c(20, rep(10, 5)) )$ # remove the value in A1 add_data(dims = \"A1\", x = \"\") # openxlsx2 with pipes border_color <- wb_color(hex = \"4F81BD\") wb <- wb_workbook(creator = \"My name here\") %>% wb_add_worksheet(sheet = \"Expenditure\", grid_lines = FALSE) %>% wb_add_data(x = USPersonalExpenditure, row_names = TRUE) %>% wb_add_border( # add the outer and inner border dims = \"A1:F6\", top_border = \"thin\", top_color = border_color, bottom_border = \"thin\", bottom_color = border_color, inner_hgrid = \"thin\", inner_hcolor = border_color, left_border = \"\", right_border = \"\" ) %>% wb_set_col_widths( # set column width cols = 1:6, widths = c(20, rep(10, 5)) ) %>% # remove the value in A1 wb_add_data(dims = \"A1\", x = \"\") # openxlsx2 wbp <- wb_workbook() %>% wb_add_worksheet() wbc <- wb_workbook()$add_worksheet() # need to assign wbp wbp <- wbp %>% wb_add_data(x = iris) wbc$add_data(x = iris)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"conditional-formatting","dir":"Articles","previous_headings":"Basic workbook functions","what":"Conditional formatting","title":"Upgrade from openxlsx","text":"See vignette(\"conditional-formatting\") extended examples formatting. minimal example:","code":"# openxlsx2 with chains wb <- wb_workbook()$ add_worksheet(\"a\")$ add_data(x = 1:4, col_names = FALSE)$ add_conditional_formatting(dims = \"A1:A4\", rule = \">2\") # openxlsx2 with pipes wb <- wb_workbook() %>% wb_add_worksheet(\"a\") %>% wb_add_data(x = 1:4, col_names = FALSE) %>% wb_add_conditional_formatting(dims = \"A1:A4\", rule = \">2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"data-validation","dir":"Articles","previous_headings":"Basic workbook functions","what":"Data validation","title":"Upgrade from openxlsx","text":"Similarly, data validation updated improved. openxlsx code data validation looks openxlsx2 something like :","code":"# openxlsx wb <- createWorkbook() addWorksheet(wb, \"Sheet 1\") writeDataTable(wb, 1, x = iris[1:30, ]) dataValidation(wb, 1, col = 1:3, rows = 2:31, type = \"whole\", operator = \"between\", value = c(1, 9) ) # openxlsx2 with chains wb <- wb_workbook()$ add_worksheet(\"Sheet 1\")$ add_data_table(1, x = iris[1:30, ])$ add_data_validation(1, dims = wb_dims(rows = 2:31, cols = 1:3), # alternatively, dims can also be \"A2:C31\" if you know the span in your Excel workbook. type = \"whole\", operator = \"between\", value = c(1, 9) ) # openxlsx2 with pipes wb <- wb_workbook() %>% wb_add_worksheet(\"Sheet 1\") %>% wb_add_data_table(1, x = iris[1:30, ]) %>% wb_add_data_validation( sheet = 1, dims = \"A2:C31\", # alternatively, dims = wb_dims(rows = 2:31, cols = 1:3) type = \"whole\", operator = \"between\", value = c(1, 9) )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"saving","dir":"Articles","previous_headings":"Basic workbook functions","what":"Saving","title":"Upgrade from openxlsx","text":"Saving switched saveWorkbook() wb_save() opening workbook switched openXL() wb_open().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"why-openxlsx2","dir":"Articles","previous_headings":"","what":"Why openxlsx2?","title":"Upgrade from openxlsx","text":"Originally, openxlsx2 started private branch openxlsx include pugixml library provide fully functional XML parser openxlsx. time, became clear home-written openxlsx XML parser limited ability reliably parse XML files, leading problems broken unreadable xlsx files. inclusion pugixml addressed, new internal structure created, structure required changes old openxlsx functions. accompanied change methods R6 possibility chaining piping functions. Working styles object openxlsx became clear great idea, work well enough needs files loaded modified openxlsx never look . always things look little style objects work perfectly. Likewise, lot edge cases openxlsx assume file structure xlsx objects simplified approximation actually going . example, openxlsx assumes sheet accompanied drawing. works many cases, match definition format openxml standard. may worksheets multiple drawings, drawing folder drawings included. Unfortunately, many things deeply embedded openxlsx code, development took place openxlsx2, things differed fork origin. point fork called independent project previously privately developed branch made public. say went hand hand modification actual project goal. , creating similar looking xlsx file able partially edit . Now writing identical xlsx file just able change everything. Since internal functions openxlsx cleaned , fixed mostly rewritten. package developed new ways handle styles styles manager, provides full range style options hard impossible include openxlsx. included support native graphs mschart feature creation pivot tables. support conditional formatting options, improved support data validation, sparklines form control objects. addition many quirks old package ironed . switched consistent stable API build dims provide multiple vignettes document code plenty functions interact openxml format. provide basic xlsb support msoc created package encrypt decrypt openxml files.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/Update-from-openxlsx.html","id":"invitation-to-contribute","dir":"Articles","previous_headings":"","what":"Invitation to contribute","title":"Upgrade from openxlsx","text":"put lot work openxls2 make useful needs, improving found useful openxlsx removing didn’t need. claim omniscient things can spreadsheet software, claim omniscient things can openxlsx2. package still active development, though reached semi stable API change next major release. quite fond little package invite others try comment like course think missing something doesn’t work. openxlsx2 complex piece software certainly work bug-free, even best. want contribute development openxlsx2, please guest Github. Join open discussion, post fix issues write us mail.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"rule-applies-to-all-each-cell-in-range","dir":"Articles","previous_headings":"","what":"Rule applies to all each cell in range","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"cellIs\") wb$add_data(\"cellIs\", -5:5) wb$add_data(\"cellIs\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"cellIs\", dims = \"A1:A11\", rule = \"!=0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"cellIs\", dims = \"A1:A11\", rule = \"==0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-row-dependent-on-first-cell-in-row","dir":"Articles","previous_headings":"","what":"Highlight row dependent on first cell in row","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Moving Row\") wb$add_data(\"Moving Row\", -5:5) wb$add_data(\"Moving Row\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"Moving Row\", dims = \"A1:B11\", rule = \"$A1<0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Moving Row\", dims = \"A1:B11\", rule = \"$A1>0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-column-dependent-on-first-cell-in-column","dir":"Articles","previous_headings":"","what":"Highlight column dependent on first cell in column","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Moving Col\") wb$add_data(\"Moving Col\", -5:5) wb$add_data(\"Moving Col\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"Moving Col\", dims = \"A1:B11\", rule = \"A$1<0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Moving Col\", dims = \"A1:B11\", rule = \"A$1>0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-entire-range-cols-x-rows-dependent-only-on-cell-a1","dir":"Articles","previous_headings":"","what":"Highlight entire range cols X rows dependent only on cell A1","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Dependent on\") wb$add_data(\"Dependent on\", -5:5) wb$add_data(\"Dependent on\", LETTERS[1:11], start_col = 2) wb$add_conditional_formatting( \"Dependent on\", dims = \"A1:B11\", rule = \"$A$1 < 0\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Dependent on\", dims = \"A1:B11\", rule = \"$A$1>0\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-cells-in-column-1-based-on-value-in-column-2","dir":"Articles","previous_headings":"","what":"Highlight cells in column 1 based on value in column 2","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_data(\"Dependent on\", data.frame(x = 1:10, y = runif(10)), startRow = 15) wb$add_conditional_formatting( \"Dependent on\", dims = \"A16:A25\", rule = \"B16<0.5\", style = \"negStyle\" ) wb$add_conditional_formatting( \"Dependent on\", dims = \"A16:A25\", rule = \"B16>=0.5\", style = \"posStyle\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"highlight-duplicates-using-default-style","dir":"Articles","previous_headings":"","what":"Highlight duplicates using default style","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"Duplicates\") wb$add_data(\"Duplicates\", sample(LETTERS[1:15], size = 10, replace = TRUE)) wb$add_conditional_formatting( \"Duplicates\", dims = \"A1:A10\", type = \"duplicatedValues\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-containing-text","dir":"Articles","previous_headings":"","what":"Cells containing text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") wb$add_worksheet(\"containsText\") wb$add_data(\"containsText\", sapply(1:10, fn)) wb$add_conditional_formatting( \"containsText\", dims = \"A1:A10\", type = \"containsText\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-not-containing-text","dir":"Articles","previous_headings":"","what":"Cells not containing text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") my_dat <- sapply(1:10, fn) wb$add_worksheet(\"notcontainsText\") wb$add_data(\"notcontainsText\", x = my_dat) wb$add_conditional_formatting( \"notcontainsText\", dims = wb_dims(x = my_dat), type = \"notContainsText\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-begins-with-text","dir":"Articles","previous_headings":"","what":"Cells begins with text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") wb$add_worksheet(\"beginsWith\") wb$add_data(\"beginsWith\", sapply(1:100, fn)) wb$add_conditional_formatting( \"beginsWith\", dims = \"A1:A100\", type = \"beginsWith\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"cells-ends-with-text","dir":"Articles","previous_headings":"","what":"Cells ends with text","title":"Add conditional formatting to a workbook","text":"","code":"fn <- function(x) paste(sample(LETTERS, 10), collapse = \"-\") wb$add_worksheet(\"endsWith\") wb$add_data(\"endsWith\", x = sapply(1:100, fn)) wb$add_conditional_formatting( \"endsWith\", dims = \"A1:A100\", type = \"endsWith\", rule = \"A\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"colorscale-colors-cells-based-on-cell-value","dir":"Articles","previous_headings":"","what":"Colorscale colors cells based on cell value","title":"Add conditional formatting to a workbook","text":"Yep, color scale image. Rule vector colors length 2 3 (hex color colors()). rule NULL, min max cells used. Rule must length style L.","code":"df <- read_xlsx(\"https://github.com/JanMarvin/openxlsx-data/raw/main/readTest.xlsx\", sheet = 5) wb$add_worksheet(\"colorScale\", zoom = 30) wb$add_data(x = df, col_names = FALSE) ## write data.frame wb$add_conditional_formatting( sheet = \"colorScale\", dims = wb_dims( rows = seq_len(nrow(df)), cols = seq_len(ncol(df)) ), # dims = wb_dims(x = df, col_names = FALSE, select = \"data\") style = c(\"black\", \"white\"), rule = c(0, 255), type = \"colorScale\" ) wb$set_col_widths(\"colorScale\", cols = seq_along(df), widths = 1.07) wb$set_row_heights(\"colorScale\", rows = seq_len(nrow(df)), heights = 7.5)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"databars","dir":"Articles","previous_headings":"","what":"Databars","title":"Add conditional formatting to a workbook","text":"","code":"wb$add_worksheet(\"databar\") ## Databars wb$add_data(\"databar\", -5:5, start_col = 1) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = \"A1:A11\", type = \"dataBar\" ) ## Default colors wb$add_data(\"databar\", -5:5, start_col = 3) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = \"C1:C11\", type = \"dataBar\", params = list( showValue = FALSE, gradient = FALSE ) ) ## Default colors wb$add_data(\"databar\", -5:5, start_col = 5) wb <- wb_add_conditional_formatting( wb, sheet = \"databar\", dims = \"E1:E11\", type = \"dataBar\", style = c(\"#a6a6a6\"), params = list(showValue = FALSE) ) wb$add_data(\"databar\", -5:5, start_col = 7) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = \"G1:G11\", type = \"dataBar\", style = c(\"red\"), params = list( showValue = TRUE, gradient = FALSE ) ) # custom color wb$add_data(\"databar\", -5:5, start_col = 9) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = wb_dims(rows = 1:11, cols = 9), type = \"dataBar\", style = c(\"#a6a6a6\", \"#a6a6a6\"), params = list(showValue = TRUE, gradient = FALSE) ) # with rule wb$add_data(x = -5:5, start_col = 11) wb <- wb_add_conditional_formatting( wb, \"databar\", dims = wb_dims(rows = 1:11, cols = 11), type = \"dataBar\", rule = c(0, 5), style = c(\"#a6a6a6\", \"#a6a6a6\"), params = list(showValue = TRUE, gradient = FALSE) )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"between","dir":"Articles","previous_headings":"","what":"Between","title":"Add conditional formatting to a workbook","text":"Highlight cells interval [-2, 2]","code":"wb$add_worksheet(\"between\") wb$add_data(\"between\", -5:5) wb$add_conditional_formatting( \"between\", dims = wb_dims(rows = 2:11, cols = 1), type = \"between\", rule = c(-2, 2) ) wb$add_worksheet(\"topN\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"top-n","dir":"Articles","previous_headings":"","what":"Top N","title":"Add conditional formatting to a workbook","text":"Highlight top 5 values column x Highlight top 20 percentage column y","code":"wb$add_data(\"topN\", data.frame(x = 1:10, y = rnorm(10))) wb$add_conditional_formatting( \"topN\", dims = wb_dims(rows = 2:11, cols = 1), style = \"posStyle\", type = \"topN\", params = list(rank = 5) ) wb$add_conditional_formatting( \"topN\", dims = wb_dims(rows = 2:11, cols = 2), style = \"posStyle\", type = \"topN\", params = list(rank = 20, percent = TRUE) ) wb$add_worksheet(\"bottomN\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"bottom-n","dir":"Articles","previous_headings":"","what":"Bottom N","title":"Add conditional formatting to a workbook","text":"Highlight bottom 5 values column x Highlight bottom 20 percentage column y","code":"wb$add_data(\"bottomN\", data.frame(x = 1:10, y = rnorm(10))) wb$add_conditional_formatting( \"bottomN\", dims = wb_dims(rows = 2:11, cols = 1), style = \"negStyle\", type = \"bottomN\", params = list(rank = 5) ) wb$add_conditional_formatting( \"bottomN\", cols = 2, rows = 2:11, style = \"negStyle\", type = \"bottomN\", params = list(rank = 20, percent = TRUE) ) wb$add_worksheet(\"logical operators\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/conditional-formatting.html","id":"logical-operators","dir":"Articles","previous_headings":"","what":"Logical Operators","title":"Add conditional formatting to a workbook","text":"can use Excels logical Operators","code":"wb$add_data(\"logical operators\", 1:10) wb$add_conditional_formatting( \"logical operators\", dims = wb_dims(rows = 1:10, cols = 1), rule = \"OR($A1=1,$A1=3,$A1=5,$A1=7)\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"importing-data","dir":"Articles","previous_headings":"","what":"Importing data","title":"openxlsx2 basic manual","text":"Coming openxlsx might know read.xlsx() (two functions, one files one workbooks) readWorkbook(). Functions different things, mostly . openxlsx2 tried best reduce complexity hood user well. openxlsx2 replaced read_xlsx(), wb_read() share underlying function wb_to_df(). example use example data provided package. can locate “inst/extdata” folder. files included package source can open calculation software well.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"basic-import","dir":"Articles","previous_headings":"Importing data","what":"Basic import","title":"openxlsx2 basic manual","text":"begin openxlsx2_example.xlsx file telling R find file system object contains path xlsx file pass file function read workbook R output created data frame contains data types date, logical, numeric character. function import file R, wb_to_df() provides similar options openxlsx functions read.xlsx() readWorkbook() new functions go options. might noticed, return column xlsx file row name data frame returned. Per default first sheet workbook imported. want switch , either provide sheet parameter correct index provide sheet name.","code":"file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") # import workbook library(openxlsx2) wb_to_df(file) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"col_names---first-row-as-column-name","dir":"Articles","previous_headings":"Importing data","what":"col_names - first row as column name","title":"openxlsx2 basic manual","text":"previous example first imported row used column name data frame. default behavior, always wanted expected. Therefore behavior can disabled user.","code":"# do not convert first row to column names wb_to_df(file, col_names = FALSE) #> B C D E F G H I J #> 2 NA Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"detect_dates---convert-cells-to-r-dates","dir":"Articles","previous_headings":"Importing data","what":"detect_dates - convert cells to R dates","title":"openxlsx2 basic manual","text":"creators openxml standard well known mistakenly treating something date openxlsx2 built ways identify cell date try convert value , unfortunately always trivial task might fail. case provide option disable date conversion entirely. case underlying numerical value returned.","code":"# do not try to identify dates in the data wb_to_df(file, detect_dates = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 45075 3209324 This #DIV/0! 0.06059028 #> 4 TRUE NA NA #NUM! b 45069 0 0.58538194 #> 5 TRUE 2 NA 1.34 c 44958 #VALUE! 0.95905093 #> 6 FALSE 2 NA #NUM! NA 2 0.72561343 #> 7 FALSE 3 NA 1.56 e NA NA #> 8 FALSE 1 NA 1.7 f 44987 2.7 0.36525463 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23 h 45284 25 NA #> 11 FALSE 3 NA 67.3 i 45285 3 NA #> 12 NA 1 NA 123 45138 122 NA"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"show_formula---show-formulas-instead-of-results","dir":"Articles","previous_headings":"Importing data","what":"show_formula - show formulas instead of results","title":"openxlsx2 basic manual","text":"Sometimes things might feel . can openxml files updating formula results sheets unless opened software provides functionality certain tabular calculation software. Therefore user might interested underlying functions see going sheet. Using show_formula possible","code":"# return the underlying Excel formula instead of their values wb_to_df(file, show_formula = TRUE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This E3/0 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 C4 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! C6+E6 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 C8+E8 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 SUM(C10,E10) #> 11 FALSE 3 NA 67.3 i 2023-12-25 PRODUCT(C11,E3) #> 12 NA 1 NA 123 2023-07-31 E12-C12 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"dims---read-specific-dimension","dir":"Articles","previous_headings":"Importing data","what":"dims - read specific dimension","title":"openxlsx2 basic manual","text":"Sometimes entire worksheet contains much data, case provide functions read selected dimension range. range consists either specific cell like “A1” cell range notion used openxml standard Alternatively, don’t know Excel sheet’s address, can use wb_dims() specify dimension. See ?wb_dims details.","code":"# read dimension without column names wb_to_df(file, dims = \"A2:C5\", col_names = FALSE) #> A B C #> 2 NA NA Var2 #> 3 NA TRUE 1 #> 4 NA TRUE #> 5 NA TRUE 2 # read dimension without column names with `wb_dims()` wb_to_df(file, dims = wb_dims(rows = 2:5, cols = 1:3), col_names = FALSE) #> A B C #> 2 NA NA Var2 #> 3 NA TRUE 1 #> 4 NA TRUE #> 5 NA TRUE 2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"cols---read-selected-columns","dir":"Articles","previous_headings":"Importing data","what":"cols - read selected columns","title":"openxlsx2 basic manual","text":"want read specific cell, cell range can use column attribute. attribute takes numeric vector argument","code":"# read selected cols wb_to_df(file, cols = c(\"A:B\", \"G\")) #> NA Var1 Var5 #> 3 NA TRUE 2023-05-29 #> 4 NA TRUE 2023-05-23 #> 5 NA TRUE 2023-02-01 #> 6 NA FALSE #> 7 NA FALSE #> 8 NA FALSE 2023-03-02 #> 9 NA NA #> 10 NA FALSE 2023-12-24 #> 11 NA FALSE 2023-12-25 #> 12 NA NA 2023-07-31"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"rows---read-selected-rows","dir":"Articles","previous_headings":"Importing data","what":"rows - read selected rows","title":"openxlsx2 basic manual","text":"goes rows. can select using numeric vectors","code":"# read selected rows wb_to_df(file, rows = c(2, 4, 6)) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 4 TRUE NA NA #NUM! b 2023-05-23 NA 0 14:02:57 #> 6 FALSE 2 NA #NUM! NA 2 17:24:53"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"convert---convert-input-to-guessed-type","dir":"Articles","previous_headings":"Importing data","what":"convert - convert input to guessed type","title":"openxlsx2 basic manual","text":"xml exists difference value types. values per default characters. provide numerics, logicals dates, openxlsx2 every software dealing xlsx files make assumptions cell type. especially tricky due notion worksheets. Unlike data frame, worksheet can wild mix types data. Even though conversion process character date numeric rather solid, sometimes user might want see data without conversion applied. might useful cases something unexpected happened import created warnings. case can look raw input data. want disable date detection well, please see entry .","code":"# convert characters to numerics and date (logical too?) wb_to_df(file, convert = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 1 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"skip_empty_rows---remove-empty-rows","dir":"Articles","previous_headings":"Importing data","what":"skip_empty_rows - remove empty rows","title":"openxlsx2 basic manual","text":"Even though openxlsx2 imports everything requested, sometimes might helpful remove empty lines data. might either left empty intentional empty formatted, cell value removed afterwards. added mostly backward comparability, default changed FALSE. behavior changed bit well. Previously empty cells removed prior conversion R data frames, now removed conversion removed completely empty","code":"# erase empty rows from dataset wb_to_df(file, sheet = 1, skip_empty_rows = TRUE) |> tail() #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"skip_empty_cols---remove-empty-columns","dir":"Articles","previous_headings":"Importing data","what":"skip_empty_cols - remove empty columns","title":"openxlsx2 basic manual","text":"columns","code":"# erase empty cols from dataset wb_to_df(file, skip_empty_cols = TRUE) #> Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 NA 1 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"row_names---keep-rownames-from-input","dir":"Articles","previous_headings":"Importing data","what":"row_names - keep rownames from input","title":"openxlsx2 basic manual","text":"Sometimes data source might provide rownames well. case can openxlsx2 treat first column rowname","code":"# convert first row to rownames wb_to_df(file, sheet = 2, dims = \"C6:G9\", row_names = TRUE) #> mpg cyl disp hp #> Mazda RX4 21.0 6 160 110 #> Mazda RX4 Wag 21.0 6 160 110 #> Datsun 710 22.8 4 108 93"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"types---convert-column-to-specific-type","dir":"Articles","previous_headings":"Importing data","what":"types - convert column to specific type","title":"openxlsx2 basic manual","text":"user know better software type expect worksheet, can provided via types. parameter takes named numeric. 0 character, 1 numeric 2 date","code":"# define type of the data.frame wb_to_df(file, cols = c(2, 5), types = c(\"Var1\" = 0, \"Var3\" = 1)) #> Var1 Var3 #> 3 TRUE 1.00 #> 4 TRUE NaN #> 5 TRUE 1.34 #> 6 FALSE NA #> 7 FALSE 1.56 #> 8 FALSE 1.70 #> 9 NA #> 10 FALSE 23.00 #> 11 FALSE 67.30 #> 12 123.00"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"start_row---where-to-begin","dir":"Articles","previous_headings":"Importing data","what":"start_row - where to begin","title":"openxlsx2 basic manual","text":"Often creator worksheet used lot creativity data begin first row, instead begins somewhere else. define row begin reading, define via start_row parameter","code":"# start in row 5 wb_to_df(file, start_row = 5, col_names = FALSE) #> B C D E F G H I J #> 5 TRUE 2 NA 1.34 c 2023-02-01 NA #VALUE! 23:01:02 #> 6 FALSE 2 NA NA #NUM! NA 2 17:24:53 #> 7 FALSE 3 NA 1.56 e NA #> 8 FALSE 1 NA 1.70 f 2023-03-02 NA 2.7 08:45:58 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23.00 h 2023-12-24 NA 25 #> 11 FALSE 3 NA 67.30 i 2023-12-25 NA 3 #> 12 NA 1 NA 123.00 2023-07-31 NA 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"na-strings---define-missing-values","dir":"Articles","previous_headings":"Importing data","what":"na.strings - define missing values","title":"openxlsx2 basic manual","text":"“#N/” string, often user faced custom missing values values interested. strings can passed character vector via na.strings","code":"# na strings wb_to_df(file, na.strings = \"\") #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"importing-as-workbook","dir":"Articles","previous_headings":"Importing data","what":"Importing as workbook","title":"openxlsx2 basic manual","text":"addition importing directly xlsx xlsm files, openxlsx2 provides wbWorkbook class used importing modifying entire openxml files R. workbook class heart openxlsx2 probably reason reading manual first place. Importing file workbook looks like : additional options wb_load() provides internal use: sheet loads selected sheet workbook data_only reads data parts workbook ignores additional graphics pivot tables. functions create workbook objects can used read data, recommend end users use . Especially intend re-export workbook afterwards. workbook imported, provide several functions interact modify (wb_to_df() function mentioned works way imported workbook). possible add new sheets remove sheets, well add remove data. R-plots can inserted also style workbook can changed, new fonts, background colors number formats. wealth options explained man pages additional style vignette (vignettes follow).","code":"# the file we are going to load file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") # loading the file into the workbook wb <- wb_load(file = file)"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"exporting-data-frames-or-vectors","dir":"Articles","previous_headings":"Exporting data","what":"Exporting data frames or vectors","title":"openxlsx2 basic manual","text":"want export data frame R, can use write_xlsx() create xlsx file. file can tweaked . See ?write_xlsx see options. (explanation examples follow).","code":"write_xlsx(x = mtcars, file = \"mtcars.xlsx\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"exporting-a-wbworkbook","dir":"Articles","previous_headings":"Exporting data","what":"Exporting a wbWorkbook","title":"openxlsx2 basic manual","text":"Imported workbooks can saved xlsx xlsm files wrapper wb_save() wb$save(). functions take filename optional overwrite option. latter set, optional guard provided check file want write already exists. careful, optional. default save file replace existing file. course, Windows, files locked (example, opened another process) replaced.","code":"# replace the existing file wb$save(\"mtcars.xlsx\") # do not overwrite the existing file try(wb$save(\"mtcars.xlsx\", overwrite = FALSE))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"dims-wb_dims","dir":"Articles","previous_headings":"","what":"dims/ wb_dims()","title":"openxlsx2 basic manual","text":"openxlsx2 functions interact worksheet cells using dims argument require users provide . dims cells cell ranges A1 notation. single argument dims hereby replaces col/row, cols/rows xy. Since A1 notation rather simple first columns might get confusing 26. Therefore provide wrapper construct :","code":"# various options wb_dims(from_row = 4) #> [1] \"A4\" wb_dims(rows = 4, cols = 4) #> [1] \"D4\" wb_dims(rows = 4, cols = \"D\") #> [1] \"D4\" wb_dims(rows = 4:10, cols = 5:9) #> [1] \"E4:I10\" wb_dims(rows = 4:10, cols = \"A:D\") # same as below #> [1] \"A4:D10\" wb_dims(rows = seq_len(7), cols = seq_len(4), from_row = 4) #> [1] \"A4:D10\" # 10 rows and 15 columns from indice B2. wb_dims(rows = 1:10, cols = 1:15, from_col = \"B\", from_row = 2) #> [1] \"B2:P11\" # data + col names wb_dims(x = mtcars) #> [1] \"A1:K33\" # only data wb_dims(x = mtcars, select = \"data\") #> [1] \"A2:K33\" # The dims of the values of a column in `x` wb_dims(x = mtcars, cols = \"cyl\") #> [1] \"B2:B33\" # a column in `x` with the column name wb_dims(x = mtcars, cols = \"cyl\", select = \"x\") #> [1] \"B1:B33\" # rows in `x` wb_dims(x = mtcars) #> [1] \"A1:K33\" # in a wb chain wb <- wb_workbook()$ add_worksheet()$ add_data(x = mtcars)$ add_fill( dims = wb_dims(x = mtcars, rows = 1:5), # only 1st 5 rows of x data color = wb_color(\"yellow\") )$ add_fill( dims = wb_dims(x = mtcars, select = \"col_names\"), # only column names color = wb_color(\"cyan2\") ) # or if the data's first coord needs to be located in B2. wb_dims_custom <- function(...) { wb_dims(x = mtcars, from_col = \"B\", from_row = 2, ...) } wb <- wb_workbook()$ add_worksheet()$ add_data(x = mtcars, dims = wb_dims_custom())$ add_fill( dims = wb_dims_custom(rows = 1:5), color = wb_color(\"yellow\") )$ add_fill( dims = wb_dims_custom(select = \"col_names\"), color = wb_color(\"cyan2\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2.html","id":"a-note-on-speed-and-memory-usage","dir":"Articles","previous_headings":"","what":"A note on speed and memory usage","title":"openxlsx2 basic manual","text":"current state openxlsx2 reasonably fast. , works well reasonably large input data reading writing. may work well data tests limits openxml specification. Things may slow R side things, performance usability depend speed size local operating system’s CPU memory. Note least two cases openxlsx2 constructs potentially large data frames () loading, openxlsx2 usually needs read entire input file pugixml convert long data frame(s), wb_to_df() converts one long data frame two data frames construct output object (ii) adding data workbook, openxlsx2 reshapes input data frame long data frame stores workbook, writes entire worksheet pugixml file written complete. Applying cell styles, date conversions etc. slow process finally sheets zipped provide xlsx output. Therefore, faced unreasonably large dataset, either give enough time, use another package write xlsx output (openxlsx2 written intention working maximum memory efficiency), means use ways store data (binary file formats database). However, always happy improve, found way improve currently , please let us know open issue pull request.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"section","dir":"Articles","previous_headings":"","what":"Add charts to a workbook","title":"Add charts to a workbook","text":"","code":"library(openxlsx2) # openxlsx2 >= 0.4 for mschart and rvg support ## create a workbook wb <- wb_workbook()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-plot-to-workbook","dir":"Articles","previous_headings":"","what":"Add plot to workbook","title":"Add charts to a workbook","text":"can include image PNG JPEG format. Simply open device save output pass worksheet wb_add_image().","code":"myplot <- tempfile(fileext = \".jpg\") jpeg(myplot) print(plot(AirPassengers)) #> NULL dev.off() #> agg_png #> 2 # Add basic plots to the workbook wb$add_worksheet(\"add_image\")$add_image(file = myplot)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-ggplot2-plot-to-workbook","dir":"Articles","previous_headings":"","what":"Add {ggplot2} plot to workbook","title":"Add charts to a workbook","text":"can include ggplot2 plots similar include openxlsx. Call plot first afterwards use wb_add_plot().","code":"if (requireNamespace(\"ggplot2\")) { library(ggplot2) p <- ggplot(mtcars, aes(x = mpg, fill = as.factor(gear))) + ggtitle(\"Distribution of Gas Mileage\") + geom_density(alpha = 0.5) print(p) # Add ggplot to the workbook wb$add_worksheet(\"add_plot\")$ add_plot(width = 5, height = 3.5, file_type = \"png\", units = \"in\") } #> Loading required namespace: ggplot2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-plot-via-rvg","dir":"Articles","previous_headings":"","what":"Add plot via {rvg}","title":"Add charts to a workbook","text":"want vector graphics can modified spreadsheet software dml_xlsx() device comes handy. can pass output via wb_add_drawing().","code":"if (requireNamespace(\"ggplot2\") && requireNamespace(\"rvg\")) { library(rvg) ## create rvg example p <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Width)) + geom_point() + labs(title = \"With font Bradley Hand\") + theme_minimal(base_family = \"sans\", base_size = 18) tmp <- tempfile(fileext = \".xml\") rvg::dml_xlsx(file = tmp, fonts = list(sans = \"Bradley Hand\")) print(p) dev.off() # Add rvg to the workbook wb$add_worksheet(\"add_drawing\")$ add_drawing(xml = tmp)$ add_drawing(xml = tmp, dims = NULL) } #> Loading required namespace: rvg"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_charts_manual.html","id":"add-mschart-plots","dir":"Articles","previous_headings":"","what":"Add {mschart} plots","title":"Add charts to a workbook","text":"want native open xml charts, look mschart. Create one chart files pass workbook wb_add_mschart(). two options possible. 1. Either default mschart output identical one officer. Passing data object let mschart prepare data. case wb_add_mschart() add new data region. 2. Passing wb_data() object mschart. object contains references data worksheet allows using data “”.","code":"if (requireNamespace(\"mschart\")) { library(mschart) # mschart >= 0.4 for openxlsx2 support ## create chart from mschart object (this creates new input data) mylc <- ms_linechart( data = browser_ts, x = \"date\", y = \"freq\", group = \"browser\" ) wb$add_worksheet(\"add_mschart\")$add_mschart(dims = \"A10:G25\", graph = mylc) ## create chart referencing worksheet cells as input # write data starting at B2 wb$add_worksheet(\"add_mschart - wb_data\")$ add_data(x = mtcars, dims = \"B2\")$ add_data(x = data.frame(name = rownames(mtcars)), dims = \"A2\") # create wb_data object this will tell this mschart # from this PR to create a file corresponding to openxlsx2 dat <- wb_data(wb, dims = \"A2:G10\") # create a few mscharts scatter_plot <- ms_scatterchart( data = dat, x = \"mpg\", y = c(\"disp\", \"hp\") ) bar_plot <- ms_barchart( data = dat, x = \"name\", y = c(\"disp\", \"hp\") ) area_plot <- ms_areachart( data = dat, x = \"name\", y = c(\"disp\", \"hp\") ) line_plot <- ms_linechart( data = dat, x = \"name\", y = c(\"disp\", \"hp\"), labels = c(\"disp\", \"hp\") ) # add the charts to the data wb <- wb %>% wb_add_mschart(dims = \"F4:L20\", graph = scatter_plot) %>% wb_add_mschart(dims = \"F21:L37\", graph = bar_plot) %>% wb_add_mschart(dims = \"M4:S20\", graph = area_plot) %>% wb_add_mschart(dims = \"M21:S37\", graph = line_plot) # add chartsheet wb <- wb %>% wb_add_chartsheet() %>% wb_add_mschart(graph = scatter_plot) } #> Loading required namespace: mschart"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"simple-formulas","dir":"Articles","previous_headings":"","what":"Simple formulas","title":"Add formulas to a workbook","text":"","code":"wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"SUM(A2, B2)\", dims = \"D2\")$ add_formula(x = \"A2 + B2\", dims = \"D3\") # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"array-formulas","dir":"Articles","previous_headings":"","what":"Array formulas","title":"Add formulas to a workbook","text":"","code":"wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"A2:A7 * B2:B7\", dims = \"C2:C7\", array = TRUE) # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"array-formulas-creating-multiple-fields","dir":"Articles","previous_headings":"","what":"Array formulas creating multiple fields","title":"Add formulas to a workbook","text":"example want use MMULT() creates matrix multiplication. requires us write array formula specify region output written . Similar coefficients linear regression","code":"m1 <- matrix(1:6, ncol = 2) m2 <- matrix(7:12, nrow = 2) wb <- wb_workbook()$add_worksheet()$ add_data(x = m1)$ add_data(x = m2, dims = wb_dims(from_col = 4))$ add_formula(x = \"MMULT(A2:B4, D2:F3)\", dims = \"H2:J4\", array = TRUE) # wb$open() # we expect to find this in D1:E1 coef(lm(head(cars))) #> (Intercept) dist #> 5.2692308 0.1153846 wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"LINEST(A2:A7, B2:B7, TRUE)\", dims = \"D2:E2\", array = TRUE) # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"cells-metadata-cm-formulas","dir":"Articles","previous_headings":"","what":"cells metadata (cm) formulas","title":"Add formulas to a workbook","text":"Similar array formulas, cell metadata (cm) formulas hide user array formulas. Using implemented openxlsx2 > 0.6.1:","code":"wb <- wb_workbook()$add_worksheet()$ add_data(x = head(cars))$ add_formula(x = \"SUM(ABS(A2:A7))\", dims = \"D2\", cm = TRUE) #> Warning in write_data2(wb = wb, sheet = sheet, data = x, name = name, colNames #> = colNames, : modifications with cm formulas are experimental. use at own risk # wb$open()"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_formulas_manual.html","id":"datatable-formula-differences","dir":"Articles","previous_headings":"dataTable formulas1","what":"dataTable formula differences","title":"Add formulas to a workbook","text":"Given basic table like , similarly basic formula total_sales “= A2 * C2” row value changing row. implementation formula using wb_add_formula() look (taken current documentation) lets say ’ve read data assigned table company_sales create workbook, worksheet, use wb_add_data_table(). One advantages open xml dataTable syntax don’t specify row numbers columns letters. table also grows dynamically, adding new rows new data appended extending formulas new rows. dataTable named columns can use instead letters. writing formulas within dataTable use following syntax [@[column_name]] reference current row. “total_sales” formula written open xml dataTable look like ; =[@[sales_price]] * [@[sales_quantity]] writing formula outside dataTable reference table name. case lets say table name ‘daily_sales’ =daily_sales[@[sales_price]] * daily_sales[@[sales_quantity]] However, pass text formula written cause error syntax open xml requires selecting current row different. open xml dataTable formula looks like : Now can see open xml replaces [@[sales_price]] daily_sales[[#Row],[sales_price]] must use syntax writing formulas dataTable open workbook view table created can see formula worked. can also see replaced [#Row] @. completion, formula wrote appears ;","code":"## creating example data company_sales <- data.frame( sales_price = c(20, 30, 40), COGS = c(5, 11, 13), sales_quantity = c(1, 2, 3) ) ## write in the formula company_sales$total_sales <- paste(paste0(\"A\", 1:3 + 1L), paste0(\"C\", 1:3 + 1L), sep = \" * \") ## add the formula class class(company_sales$total_sales) <- c(class(company_sales$total_sales), \"formula\") ## write a workbook wb <- wb_workbook()$ add_worksheet(\"Total Sales\")$ add_data_table(x = company_sales) daily_sales[[#This Row],[sales_price]]*daily_sales[[#ThisRow],[sales_quantity]] <\/calculatedColumnFormula> ## Because we want the `dataTable` formula to propagate down the entire column of the data ## we can assign the formula by itself to any column and allow that single string to be repeated for each row. ## creating example data example_data <- data.frame( sales_price = c(20, 30, 40), COGS = c(5, 11, 13), sales_quantity = c(1, 2, 3) ) ## base R method example_data$gross_profit <- \"daily_sales[[#This Row],[sales_price]] - daily_sales[[#This Row],[COGS]]\" example_data$total_COGS <- \"daily_sales[[#This Row],[COGS]] * daily_sales[[#This Row],[sales_quantity]]\" example_data$total_sales <- \"daily_sales[[#This Row],[sales_price]] * daily_sales[[#This Row],[sales_quantity]]\" example_data$total_gross_profit <- \"daily_sales[[#This Row],[total_sales]] - daily_sales[[#This Row],[total_COGS]]\" class(example_data$gross_profit) <- c(class(example_data$gross_profit), \"formula\") class(example_data$total_COGS) <- c(class(example_data$total_COGS), \"formula\") class(example_data$total_sales) <- c(class(example_data$total_sales), \"formula\") class(example_data$total_gross_profit) <- c(class(example_data$total_gross_profit), \"formula\") wb$ add_worksheet(\"Daily Sales\")$ add_data_table( x = example_data, table_style = \"TableStyleMedium2\", table_name = \"daily_sales\" ) #### sum dataTable examples wb$add_worksheet(\"sum_examples\") ### Note: dataTable formula do not need to be used inside of dataTables. dataTable formula are for referencing the data within the dataTable. ### Note: dataTable formula do not need to be used inside of dataTables. dataTable formula are for referencing the data within the dataTable. sum_examples <- data.frame( description = c(\"sum_sales_price\", \"sum_product_Price_Quantity\"), formula = c(\"\", \"\") ) wb$add_data(x = sum_examples) # add formulas wb$add_formula(x = \"sum(daily_sales[[#Data],[sales_price]])\", dims = \"B2\") wb$add_formula(x = \"sum(daily_sales[[#Data],[sales_price]] * daily_sales[[#Data],[sales_quantity]])\", dims = \"B3\", array = TRUE) #### dataTable referencing wb$add_worksheet(\"dt_references\") ### Adding the headers by themselves. wb$add_formula( x = \"daily_sales[[#Headers],[sales_price]:[total_gross_profit]]\", dims = \"A1:G1\", array = TRUE ) ### Adding the raw data by reference and selecting them directly. wb$add_formula( x = \"daily_sales[[#Data],[sales_price]:[total_gross_profit]]\", start_row = 2, dims = \"A2:G4\", array = TRUE ) # wb$open()"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"colors-text-rotation-and-number-formats","dir":"Articles","previous_headings":"Styling showcase","what":"Colors, text rotation and number formats","title":"Add styling to a workbook","text":"show two ways create styled tables openxlsx2 one using high level functions style worksheet areas one using bare metal approach creating identical table. show ways create styles openxlsx2 show build functions create functions. example , increased column width.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-quick-way-using-high-level-functions","dir":"Articles","previous_headings":"Styling showcase > Colors, text rotation and number formats","what":"the quick way: using high level functions","title":"Add styling to a workbook","text":"","code":"# add some dummy data set.seed(123) mat <- matrix(rnorm(28 * 28, mean = 44444, sd = 555), ncol = 28) colnames(mat) <- make.names(seq_len(ncol(mat))) border_col <- wb_color(theme = 1) border_sty <- \"thin\" # using ) to avoid counting manually which `dims` are spanned. dims_mat_header <- wb_dims(rows = 1, cols = seq_len(ncol(mat))) # returns \"A1:AB1\" # prepare workbook with data and formated first row wb <- wb_workbook() %>% wb_add_worksheet(\"test\") %>% wb_add_data(x = mat) %>% wb_add_border(dims = dims_mat_header, top_color = border_col, top_border = border_sty, bottom_color = border_col, bottom_border = border_sty, left_color = border_col, left_border = border_sty, right_color = border_col, right_border = border_sty, inner_hcolor = border_col, inner_hgrid = border_sty ) %>% wb_add_fill(dims = dims_mat_header, color = wb_color(hex = \"FF334E6F\")) %>% wb_add_font(dims = dims_mat_header, name = \"Arial\", bold = TRUE, color = wb_color(\"white\"), size = 20) %>% wb_add_cell_style(dims = dims_mat_header, horizontal = \"center\", textRotation = 45) # create various number formats x <- c( 0, 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 37, 38, 39, 40, 45, 46, 47, 48, 49 ) # apply the styles for (i in seq_along(x)) { cell <- sprintf(\"%s2:%s29\", int2col(i), int2col(i)) wb <- wb %>% wb_add_numfmt(dims = cell, numfmt = x[i]) } # wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-long-way-using-bare-metal-functions","dir":"Articles","previous_headings":"Styling showcase > Colors, text rotation and number formats","what":"the long way: using bare metal functions","title":"Add styling to a workbook","text":"","code":"# create workbook wb <- wb_workbook() %>% wb_add_worksheet(\"test\") # add some dummy data to the worksheet set.seed(123) mat <- matrix(rnorm(28 * 28, mean = 44444, sd = 555), ncol = 28) colnames(mat) <- make.names(seq_len(ncol(mat))) wb$add_data(x = mat, col_names = TRUE) # create a border style and assign it to the workbook black <- wb_color(\"black\") # same as wb_color(\"black\") or wb_color(hex = \"FF000000\") or wb_color(\"FF000000\") new_border <- create_border( bottom = \"thin\", bottom_color = black, top = \"thin\", top_color = black, left = \"thin\", left_color = black, right = \"thin\", right_color = black ) wb$styles_mgr$add(new_border, \"new_border\") # create a fill style and assign it to the workbook new_fill <- create_fill(patternType = \"solid\", fgColor = wb_color(hex = \"FF334E6F\")) wb$styles_mgr$add(new_fill, \"new_fill\") # create a font style and assign it to the workbook new_font <- create_font(sz = 20, name = \"Arial\", b = TRUE, color = wb_color(\"white\")) wb$styles_mgr$add(new_font, \"new_font\") # create a new cell style, that uses the fill, the font and the border style new_cellxfs <- create_cell_style( num_fmt_id = 0, horizontal = \"center\", text_rotation = 45, fill_id = wb$styles_mgr$get_fill_id(\"new_fill\"), font_id = wb$styles_mgr$get_font_id(\"new_font\"), border_id = wb$styles_mgr$get_border_id(\"new_border\") ) # assign this style to the workbook wb$styles_mgr$add(new_cellxfs, \"new_styles\") # assign the new cell style to the header row of our data set # Achieve the same with `wb_dims()` and sprintf # cell <- sprintf(\"A1:%s1\", int2col(nrow(mat))) cell <- wb_dims(rows = 1, cols = seq_len(ncol(mat))) wb <- wb %>% wb_set_cell_style( dims = cell, style = wb$styles_mgr$get_xf_id(\"new_styles\") ) ## style the cells with some builtin format codes (no new numFmt entry is needed) # add builtin style ids x <- c( 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 37, 38, 39, 40, 45, 46, 47, 48, 49 ) # create styles new_cellxfs <- create_cell_style(num_fmt_id = x, horizontal = \"center\") # assign the styles to the workbook for (i in seq_along(x)) { wb$styles_mgr$add(new_cellxfs[i], paste0(\"new_style\", i)) } # new styles are 1:28 new_styles <- wb$styles_mgr$get_xf() for (i in as.integer(new_styles$id[new_styles$name %in% paste0(\"new_style\", seq_along(x))])) { cell <- wb_dims(rows = seq_len(nrow(mat)), cols = i, from_row = 2) wb <- wb %>% wb_set_cell_style(dims = cell, style = i) } # assign a custom tabColor wb$worksheets[[1]]$sheetPr <- xml_node_create( \"sheetPr\", xml_children = xml_node_create( \"tabColor\", xml_attributes = wb_color(hex = \"FF00FF00\") ) ) # # look at the beauty you've created # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"working-with-number-formats","dir":"Articles","previous_headings":"","what":"Working with number formats","title":"Add styling to a workbook","text":"default, openxlsx2 pick number formats selected R classes.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"numfmts","dir":"Articles","previous_headings":"Working with number formats","what":"numfmts","title":"Add styling to a workbook","text":"","code":"## Create Workbook object and add worksheets wb <- wb_workbook() wb$add_worksheet(\"S1\") wb$add_worksheet(\"S2\") df <- data.frame( \"Date\" = Sys.Date() - 0:19, \"T\" = TRUE, \"F\" = FALSE, \"Time\" = Sys.time() - 0:19 * 60 * 60, \"Cash\" = paste(\"$\", 1:20), \"Cash2\" = 31:50, \"hLink\" = \"https://CRAN.R-project.org/\", \"Percentage\" = seq(0, 1, length.out = 20), \"TinyNumbers\" = runif(20) / 1E9, stringsAsFactors = FALSE ) ## openxlsx will apply default Excel styling for these classes class(df$Cash) <- c(class(df$Cash), \"currency\") class(df$Cash2) <- c(class(df$Cash2), \"accounting\") class(df$hLink) <- \"hyperlink\" class(df$Percentage) <- c(class(df$Percentage), \"percentage\") class(df$TinyNumbers) <- c(class(df$TinyNumbers), \"scientific\") wb$add_data(\"S1\", x = df, start_row = 4, row_names = FALSE) wb$add_data_table(\"S2\", x = df, start_row = 4, row_names = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"numfmts2","dir":"Articles","previous_headings":"Working with number formats","what":"numfmts2","title":"Add styling to a workbook","text":"addition, can set style picked using openxlsx2 options.","code":"wb <- wb_workbook() wb <- wb_add_worksheet(wb, \"test\") options(\"openxlsx2.dateFormat\" = \"yyyy\") options(\"openxlsx2.datetimeFormat\" = \"yyyy-mm-dd\") options(\"openxlsx2.numFmt\" = \"€ #.0\") df <- data.frame( \"Date\" = Sys.Date() - 0:19, \"T\" = TRUE, \"F\" = FALSE, \"Time\" = Sys.time() - 0:19 * 60 * 60, \"Cash\" = paste(\"$\", 1:20), \"Cash2\" = 31:50, \"hLink\" = \"https://CRAN.R-project.org/\", \"Percentage\" = seq(0, 1, length.out = 20), \"TinyNumbers\" = runif(20) / 1E9, stringsAsFactors = FALSE, \"numeric\" = 1 ) ## openxlsx will apply default Excel styling for these classes class(df$Cash) <- c(class(df$Cash), \"currency\") class(df$Cash2) <- c(class(df$Cash2), \"accounting\") class(df$hLink) <- \"hyperlink\" class(df$Percentage) <- c(class(df$Percentage), \"percentage\") class(df$TinyNumbers) <- c(class(df$TinyNumbers), \"scientific\") wb$add_data(\"test\", df)"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"wb_set_col_widths","dir":"Articles","previous_headings":"Modifying the column widths","what":"wb_set_col_widths","title":"Add styling to a workbook","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars, row_names = TRUE) cols <- 1:12 wb <- wb %>% wb_set_col_widths(cols = cols, widths = \"auto\")"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"add-borders","dir":"Articles","previous_headings":"Adding borders","what":"add borders","title":"Add styling to a workbook","text":"","code":"wb <- wb_workbook() # full inner grid wb$add_worksheet(sheet = \"S1\", grid_lines = FALSE)$ add_data(x = mtcars) wb$add_border( dims = \"A2:K33\", # can use wb_dims(rows = 2:33, cols = ncol(mtcars)) inner_hgrid = \"thin\", inner_hcolor = wb_color(hex = \"FF808080\"), inner_vgrid = \"thin\", inner_vcolor = wb_color(hex = \"FF808080\") ) # only horizontal grid wb$add_worksheet(\"S2\", grid_lines = FALSE)$ add_data(x = mtcars) wb$add_border( dims = \"A2:K33\", inner_hgrid = \"thin\", inner_hcolor = wb_color(hex = \"FF808080\") ) # only vertical grid wb$add_worksheet(\"S3\", grid_lines = FALSE)$ add_data(x = mtcars) wb$add_border( dims = \"A2:K33\", inner_vgrid = \"thin\", inner_vcolor = wb_color(hex = \"FF808080\") ) # no inner grid wb$add_worksheet(\"S4\", grid_lines = FALSE)$add_data(x = mtcars) wb$add_border(\"S4\", dims = \"A2:K33\") # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"styled-table","dir":"Articles","previous_headings":"Adding borders","what":"styled table","title":"Add styling to a workbook","text":"show two ways create styled tables openxlsx2 one using high level functions style worksheet areas one using bare metal approach creating identical table.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-quick-way-using-high-level-functions-1","dir":"Articles","previous_headings":"Adding borders > styled table","what":"the quick way: using high level functions","title":"Add styling to a workbook","text":"","code":"# add some dummy data to the worksheet mat <- matrix(1:4, ncol = 2, nrow = 2) colnames(mat) <- make.names(seq_len(ncol(mat))) wb <- wb_workbook() %>% wb_add_worksheet(\"test\") %>% wb_add_data(x = mat, dims = wb_dims(from_row = 2, from_col = 2)) %>% # center first row wb_add_cell_style(dims = \"B2:C2\", horizontal = \"center\") %>% # add border for first row wb_add_border( dims = \"B2:C2\", bottom_color = wb_color(theme = 1), bottom_border = \"thin\", top_color = wb_color(theme = 1), top_border = \"double\", left_border = NULL, right_border = NULL ) %>% # add border for last row wb_add_border( dims = \"B4:C4\", bottom_color = wb_color(theme = 1), bottom_border = \"double\", top_border = NULL, left_border = NULL, right_border = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"the-long-way-creating-everything-from-the-bone","dir":"Articles","previous_headings":"Adding borders > styled table","what":"the long way: creating everything from the bone","title":"Add styling to a workbook","text":"","code":"# add some dummy data to the worksheet mat <- matrix(1:4, ncol = 2, nrow = 2) colnames(mat) <- make.names(seq_len(ncol(mat))) wb <- wb_workbook() %>% wb_add_worksheet(\"test\") %>% wb_add_data( x = mat, dims = wb_dims(2, 2) ) # create a border style and assign it to the workbook black <- wb_color(\"black\") top_border <- create_border( top = \"double\", top_color = black, bottom = \"thin\", bottom_color = black ) bottom_border <- create_border(bottom = \"double\", bottom_color = black) wb$styles_mgr$add(top_border, \"top_border\") wb$styles_mgr$add(bottom_border, \"bottom_border\") # create a new cell style, that uses the fill, the font and the border style top_cellxfs <- create_cell_style( num_fmt_id = 0, horizontal = \"center\", border_id = wb$styles_mgr$get_border_id(\"top_border\") ) bottom_cellxfs <- create_cell_style( num_fmt_id = 0, border_id = wb$styles_mgr$get_border_id(\"bottom_border\") ) # assign this style to the workbook wb$styles_mgr$add(top_cellxfs, style_name = \"top_styles\") wb$styles_mgr$add(bottom_cellxfs, \"bottom_styles\") # assign the new cell style to the header row of our data set cell <- \"B2:C2\" wb <- wb %>% wb_set_cell_style(dims = cell, style = wb$styles_mgr$get_xf_id(\"top_styles\")) cell <- \"B4:C4\" wb <- wb %>% wb_set_cell_style(dims = cell, style = wb$styles_mgr$get_xf_id(\"bottom_styles\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"use-workbook-colors-and-modify-them","dir":"Articles","previous_headings":"","what":"Use workbook colors and modify them","title":"Add styling to a workbook","text":"loop apply tint attribute fill color Tint variations theme colors.","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") tints <- seq(-0.9, 0.9, by = 0.1) for (i in 0:9) { for (tnt in tints) { col <- paste0(int2col(i + 1), which(tints %in% tnt)) if (tnt == 0) { wb <- wb %>% wb_add_fill(dims = col, color = wb_color(theme = i)) } else { wb <- wb %>% wb_add_fill(dims = col, color = wb_color(theme = i, tint = tnt)) } } }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"copy-cell-styles","dir":"Articles","previous_headings":"","what":"Copy cell styles","title":"Add styling to a workbook","text":"possible copy styles several cells . following example, styles cells formatted workbook applied previously empty cell range. careful though, wb_get_cell_style() returns styles, make sure copy-copy-dimensions match meaningful way.","code":"wb <- wb_load(system.file(\"extdata\", \"oxlsx2_sheet.xlsx\", package = \"openxlsx2\")) %>% wb_set_cell_style(1, \"A30:G35\", wb_get_cell_style(., 1, \"A10:G15\")) # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"style-strings","dir":"Articles","previous_headings":"","what":"Style strings","title":"Add styling to a workbook","text":"Using fmt_txt() possible style strings independently cell containing string. shown possible combine multiple styles together longer string. even possible use fmt_txt() na.strings:","code":"txt <- paste( fmt_txt(\"Embracing the full potential of \"), fmt_txt(\"openxlsx2\", bold = TRUE, size = 16), fmt_txt(\" with \"), fmt_txt(\"fmt_txt()\", font = \"Courier\"), fmt_txt(\" !\") ) wb <- wb_workbook()$add_worksheet()$add_data(x = txt) df <- mtcars df[df < 4] <- NA na_red <- fmt_txt(\"N/A\", color = wb_color(\"red\"), italic = TRUE, bold = TRUE) wb <- wb_workbook()$add_worksheet()$add_data(x = df, na.strings = na_red)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/articles/openxlsx2_style_manual.html","id":"create-custom-table-styles","dir":"Articles","previous_headings":"","what":"Create custom table styles","title":"Add styling to a workbook","text":"create_tablestyle() possible create table styles. function uses create_dxfs_style() (just like spreadsheet software ). Therefore, quite user-friendly. following example shows function creates red table style. various dxfs styles must created assigned workbook (similar styles used conditional formatting). create_tablestyle() styles assigned table style elements. table style created, must also assigned workbook. can use workbook like table style.","code":"# a red table style dx0 <- create_dxfs_style( border = TRUE, left_color = wb_color(\"red\"), right_color = NULL, right_style = NULL, top_color = NULL, top_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx1 <- create_dxfs_style( border = TRUE, left_color = wb_color(\"red\"), right_color = NULL, right_style = NULL, top_color = NULL, top_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx2 <- create_dxfs_style( border = TRUE, top_color = wb_color(\"red\"), left_color = NULL, left_style = NULL, right_color = NULL, right_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx3 <- create_dxfs_style( border = TRUE, top_color = wb_color(\"red\"), left_color = NULL, left_style = NULL, right_color = NULL, right_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx4 <- create_dxfs_style( text_bold = TRUE ) dx5 <- create_dxfs_style( text_bold = TRUE ) dx6 <- create_dxfs_style( font_color = wb_color(\"red\"), text_bold = TRUE, border = TRUE, top_style = \"double\", left_color = NULL, left_style = NULL, right_color = NULL, right_style = NULL, bottom_color = NULL, bottom_style = NULL ) dx7 <- create_dxfs_style( font_color = wb_color(\"white\"), text_bold = TRUE, bgFill = wb_color(\"red\"), fgColor = wb_color(\"red\") ) dx8 <- create_dxfs_style( border = TRUE, left_color = wb_color(\"red\"), top_color = wb_color(\"red\"), right_color = wb_color(\"red\"), bottom_color = wb_color(\"red\") ) wb <- wb_workbook() %>% wb_add_worksheet(grid_lines = FALSE) wb$add_style(dx0) wb$add_style(dx1) wb$add_style(dx2) wb$add_style(dx3) wb$add_style(dx4) wb$add_style(dx5) wb$add_style(dx6) wb$add_style(dx7) wb$add_style(dx8) # finally create the table xml <- create_tablestyle( name = \"red_table\", whole_table = wb$styles_mgr$get_dxf_id(\"dx8\"), header_row = wb$styles_mgr$get_dxf_id(\"dx7\"), total_row = wb$styles_mgr$get_dxf_id(\"dx6\"), first_column = wb$styles_mgr$get_dxf_id(\"dx5\"), last_column = wb$styles_mgr$get_dxf_id(\"dx4\"), first_row_stripe = wb$styles_mgr$get_dxf_id(\"dx3\"), second_row_stripe = wb$styles_mgr$get_dxf_id(\"dx2\"), first_column_stripe = wb$styles_mgr$get_dxf_id(\"dx1\"), second_column_stripe = wb$styles_mgr$get_dxf_id(\"dx0\") ) wb$add_style(xml) # create a table and apply the custom style wb <- wb %>% wb_add_data_table(x = mtcars, table_style = \"red_table\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jordan Mark Barbone. Author. Jan Marvin Garbuszus. Author, maintainer. Oliver Roy. Contributor. openxlsx authors. Copyright holder. openxlsx package Arseny Kapoulkine. Contributor, copyright holder. Author included pugixml code","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"(2023). openxlsx2: Read, Write Edit 'xlsx' Files. R package version 1.1.0.9000. URL https://github.com/JanMarvin/openxlsx2.","code":"@Manual{, title = {openxlsx2: Read, Write and Edit 'xlsx' Files}, year = {2023}, note = {R package version 1.1.0.9000}, url = {https://janmarvin.github.io/openxlsx2/}, }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"openxlsx2","dir":"","previous_headings":"","what":"Read, Write and Edit xlsx Files","title":"Read, Write and Edit xlsx Files","text":"R package modern reinterpretation widely used popular openxlsx package. Similar predecessor, simplifies creation xlsx files providing clean interface writing, designing editing worksheets. Based powerful XML library focusing modern programming flows pipes chains, openxlsx2 allows break many new ground.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Read, Write and Edit xlsx Files","text":"can install stable version openxlsx2 : can install development version openxlsx2 GitHub : r-universe :","code":"install.packages('openxlsx2') # install.packages(\"remotes\") remotes::install_github(\"JanMarvin/openxlsx2\") # Enable repository from janmarvin options(repos = c( janmarvin = 'https://janmarvin.r-universe.dev', CRAN = 'https://cloud.r-project.org')) # Download and install openxlsx2 in R install.packages('openxlsx2')"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"introduction","dir":"","previous_headings":"","what":"Introduction","title":"Read, Write and Edit xlsx Files","text":"openxlsx2 aims swiss knife working openxml spreadsheet formats xlsx, xlsm (limited) xlsb (formats spreadsheet software supported). offer two different variants work openxlsx2. first one simply work R objects. possible read (read_xlsx()) write (write_xlsx()) data files. offer number options commands support various features openxml format, including reading writing named ranges tables. Furthermore, several ways read certain information openxml spreadsheet without opened spreadsheet software , e.g. get contained sheet names tables. second variant openxlsx2 offers work called wbWorkbook objects. openxml file read corresponding wbWorkbook object (wb_load()) new one created (wb_workbook()). Afterwards object can modified using various functions. example, worksheets can added removed, layout cells entire worksheets can changed, cells can modified (overwritten rewritten). Afterwards wbWorkbook objects can written openxml files processed suitable spreadsheet software. Many examples work openxlsx2 manual pages vignettes. can find :","code":"vignette(package = \"openxlsx2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Read, Write and Edit xlsx Files","text":"basic example shows solve common problem:","code":"library(openxlsx2) # read xlsx or xlsm files path <- system.file(\"extdata/openxlsx2_example.xlsx\", package = \"openxlsx2\") read_xlsx(path) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # or import workbooks wb <- wb_load(path) wb #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet1, Sheet2 #> Write order: 1, 2 # read a data frame wb_to_df(wb) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # and save temp <- temp_xlsx() if (interactive()) wb_save(wb, temp) ## or create one yourself wb <- wb_workbook() # add a worksheet wb$add_worksheet(\"sheet\") # add some data wb$add_data(\"sheet\", cars) # open it in your default spreadsheet software if (interactive()) wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"authors-and-contributions","dir":"","previous_headings":"","what":"Authors and contributions","title":"Read, Write and Edit xlsx Files","text":"full list authors made package possible greatful, please see: feel like included list, please let us know. something contribute, welcome. something working expected, open issues solved issue, open pull request. Please respectful aware volunteers fun unpaid free time. work problems time need.","code":"system.file(\"AUTHORS\", package = \"openxlsx2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Read, Write and Edit xlsx Files","text":"package licensed MIT license based openxlsx (Alexander Walker Philipp Schauberger; COPYRIGHT 2014-2022) pugixml (Arseny Kapoulkine; COPYRIGHT 2006-2023). released MIT license.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"Get set table sheets state selected active workbook Multiple sheets can selected, single one can active (visible). visible sheet, must necessarily selected sheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"","code":"wb_get_active_sheet(wb) wb_set_active_sheet(wb, sheet) wb_get_selected(wb) wb_set_selected(wb, sheet)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"wb workbook sheet sheet name workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"data frame tabSelected names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/active_sheet-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the state of active and selected sheets in a workbook — active_sheet-wb","text":"","code":"wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) # testing is the selected sheet wb_get_selected(wb) #> tabSelected topLeftCell workbookViewId names #> 1 1 0 Sheet1 #> 2 A3 0 Sheet2 # change the selected sheet to Sheet2 wb <- wb_set_selected(wb, \"Sheet2\") # get the active sheet wb_get_active_sheet(wb) #> numeric(0) # change the selected sheet to Sheet2 wb <- wb_set_active_sheet(wb, sheet = \"Sheet2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"loads character string to pugixml and returns an externalptr — as_xml","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"loads character string pugixml returns externalptr","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"","code":"as_xml(x, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"x input xml ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"might useful larger documents single nodes shortened otherwise full tree reimported. unsure case. useful, printing nodes larger tree, exported characters (point time convert xml R)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/as_xml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"loads character string to pugixml and returns an externalptr — as_xml","text":"","code":"tmp_xlsx <- tempfile() xlsxFile <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") unzip(xlsxFile, exdir = tmp_xlsx) wb <- wb_load(xlsxFile) styles_xml <- sprintf(\"%s/xl/styles.xml\", tmp_xlsx) # is external pointer sxml <- read_xml(styles_xml) # is character font <- xml_node(sxml, \"styleSheet\", \"fonts\", \"font\") # is again external pointer as_xml(font) #> #> #> #> #> #> #> <\/font> #> #> #> #> #> #> <\/font> #> #> #> #> #> #> <\/font>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the default font in a workbook — base_font-wb","title":"Set the default font in a workbook — base_font-wb","text":"Modify / get default font workbook. base font workbook affect font data tables.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the default font in a workbook — base_font-wb","text":"","code":"wb_set_base_font( wb, font_size = 11, font_color = wb_color(theme = \"1\"), font_name = \"Calibri\", ... ) wb_get_base_font(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the default font in a workbook — base_font-wb","text":"wb workbook object font_size Font size font_color Font color font_name Name font ... Additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set the default font in a workbook — base_font-wb","text":"font name validated anyway. Excel replaces unknown font names Arial. default base font Calibri, black, size 11.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/base_font-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set the default font in a workbook — base_font-wb","text":"","code":"## create a workbook wb <- wb_workbook() wb$add_worksheet(\"S1\") ## modify base font to size 10 Arial Narrow in red wb$set_base_font(font_size = 10, font_color = wb_color(\"red\"), font_name = \"Arial Narrow\") wb$add_data(x = iris) ## font color does not affect tables wb$add_data_table(x = iris, dims = wb_dims(from_col = 10)) ## get the base font wb_get_base_font(wb) #> $size #> $size$val #> [1] \"10\" #> #> #> $color #> $color$rgb #> [1] \"FFFF0000\" #> #> #> $name #> $name$val #> [1] \"Arial Narrow\" #> #>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Clean worksheet name — clean_worksheet_name","title":"Clean worksheet name — clean_worksheet_name","text":"Cleans worksheet name removing legal characters.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Clean worksheet name — clean_worksheet_name","text":"","code":"clean_worksheet_name(x, replacement = \" \")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Clean worksheet name — clean_worksheet_name","text":"x vector, coerced character replacement single value replace illegal characters .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Clean worksheet name — clean_worksheet_name","text":"x bad characters removed","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/clean_worksheet_name.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Clean worksheet name — clean_worksheet_name","text":"Illegal characters considered \\, /, ?, *, :, [, ]. must intentionally removed worksheet names prior creating new worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Excel column to integer — col2int","title":"Convert Excel column to integer — col2int","text":"Converts Excel column label integer.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Excel column to integer — col2int","text":"","code":"col2int(x)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Excel column to integer — col2int","text":"x character vector","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Excel column to integer — col2int","text":"integer column label (NULL x NULL)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col2int.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert Excel column to integer — col2int","text":"","code":"col2int(LETTERS) #> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #> [26] 26"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column widths of a worksheet — col_widths-wb","title":"Modify column widths of a worksheet — col_widths-wb","text":"Remove / set worksheet column widths specified width \"auto\".","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column widths of a worksheet — col_widths-wb","text":"","code":"wb_set_col_widths( wb, sheet = current_sheet(), cols, widths = 8.43, hidden = FALSE ) wb_remove_col_widths(wb, sheet = current_sheet(), cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column widths of a worksheet — col_widths-wb","text":"wb wbWorkbook object. sheet name index worksheet, vector case remove_ cols Indices cols set/remove column widths. widths Width set cols specified column width \"auto\" automatic sizing. widths recycled length cols. openxlsx2 sets default width 8.43, standard spreadsheet software. See Details general information column widths. hidden Logical vector recycled length cols. TRUE, columns hidden.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify column widths of a worksheet — col_widths-wb","text":"global min max column width \"auto\" columns set (default values show): options(\"openxlsx2.minWidth\" = 3) options(\"openxlsx2.maxWidth\" = 250) Maximum width allowed Excel NOTE: calculation column widths can slow large worksheets. NOTE: hidden parameter may conflict one set wb_group_cols(); changing one update . NOTE: default column width varies spreadsheet software, operating system, DPI settings used. Setting widths specific value also guarantee output consistent column widths.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/col_widths-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column widths of a worksheet — col_widths-wb","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\") ## set col widths wb$set_col_widths(cols = c(1, 4, 6, 7, 9), widths = c(16, 15, 12, 18, 33)) ## auto columns wb$add_worksheet(\"Sheet 2\") wb$add_data(sheet = 2, x = iris) wb$set_col_widths(sheet = 2, cols = 1:5, widths = \"auto\") ## removing column widths ## Create a new workbook wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) ## remove column widths in columns 1 to 20 wb_remove_col_widths(wb, 1, cols = 1:20)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":null,"dir":"Reference","previous_headings":"","what":"Internal comment functions — comment_internal","title":"Internal comment functions — comment_internal","text":"Users advised use wb_add_comment() wb_remove_comment(). function used internally openxlsx2. stop exporting point future. Use replacement function earliest convenience.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Internal comment functions — comment_internal","text":"","code":"write_comment( wb, sheet, col = NULL, row = NULL, comment, dims = rowcol_to_dim(row, col) ) remove_comment( wb, sheet, col = NULL, row = NULL, gridExpand = TRUE, dims = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Internal comment functions — comment_internal","text":"wb workbook object sheet worksheet workbook row, col Row column cell comment object created create_comment() dims Optional row column spreadsheet dimension, e.g. \"A1\" gridExpand TRUE, data rectangle min(rows):max(rows) X min(cols):max(cols) removed.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/comment_internal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Internal comment functions — comment_internal","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") # add a comment without author c1 <- wb_comment(text = \"this is a comment\", author = \"\") wb$add_comment(dims = \"B10\", comment = c1) #' # Remove comment wb$remove_comment(sheet = \"Sheet 1\", dims = \"B10\") # Write another comment with author information c2 <- wb_comment(text = \"this is another comment\", author = \"Marco Polo\", visible = TRUE) wb$add_comment(sheet = 1, dims = \"C10\", comment = c2) # Works with formatted text also. formatted_text <- fmt_txt(\"bar\", underline = TRUE) wb$add_comment(dims = \"B5\", comment = formatted_text)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convertToExcelDate.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert to Excel data — convertToExcelDate","title":"Convert to Excel data — convertToExcelDate","text":"Use convert_to_excel_date() new code","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convertToExcelDate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert to Excel data — convertToExcelDate","text":"df dataframe date1904 take different origin","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert from Excel date, datetime or hms number to R Date type — convert_date","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"Convert Excel date number R Date type","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"","code":"convert_date(x, origin = \"1900-01-01\", ...) convert_datetime(x, origin = \"1900-01-01\", ...) convert_hms(x)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"x vector integers origin date. Default value Windows Excel 2010 ... Arguments passed base::.Date","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"date, datetime, hms.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"Excel stores dates number days origin day","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_date.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert from Excel date, datetime or hms number to R Date type — convert_date","text":"","code":"# date -- ## 2014 April 21st to 25th convert_date(c(41750, 41751, 41752, 41753, 41754, NA)) #> [1] \"2014-04-21\" \"2014-04-22\" \"2014-04-23\" \"2014-04-24\" \"2014-04-25\" #> [6] NA convert_date(c(41750.2, 41751.99, NA, 41753)) #> [1] \"2014-04-21\" \"2014-04-22\" NA \"2014-04-24\" # datetime -- ## 2014-07-01, 2014-06-30, 2014-06-29 x <- c(41821.8127314815, 41820.8127314815, NA, 41819, NaN) convert_datetime(x) #> [1] \"2014-07-01 19:30:20 UTC\" \"2014-06-30 19:30:20 UTC\" #> [3] NA \"2014-06-29 00:00:00 UTC\" #> [5] NA convert_datetime(x, tz = \"Australia/Perth\") #> [1] \"2014-07-01 11:30:20 UTC\" \"2014-06-30 11:30:20 UTC\" #> [3] NA \"2014-06-28 16:00:00 UTC\" #> [5] NA convert_datetime(x, tz = \"UTC\") #> [1] \"2014-07-01 19:30:20 UTC\" \"2014-06-30 19:30:20 UTC\" #> [3] NA \"2014-06-29 00:00:00 UTC\" #> [5] NA # hms --- ## 12:13:14 x <- 0.50918982 convert_hms(x) #> [1] \"12:13:14\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":null,"dir":"Reference","previous_headings":"","what":"convert back to an Excel Date — convert_to_excel_date","title":"convert back to an Excel Date — convert_to_excel_date","text":"convert back Excel Date","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"convert back to an Excel Date — convert_to_excel_date","text":"","code":"convert_to_excel_date(df, date1904 = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"convert back to an Excel Date — convert_to_excel_date","text":"df dataframe date1904 take different origin","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/convert_to_excel_date.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"convert back to an Excel Date — convert_to_excel_date","text":"","code":"xlsxFile <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb1 <- wb_load(xlsxFile) df <- wb_to_df(wb1) # conversion is done on dataframes only convert_to_excel_date(df = df[\"Var5\"], date1904 = FALSE) #> Var5 #> 3 45075 #> 4 45069 #> 5 44958 #> 6 NA #> 7 NA #> 8 44987 #> 9 NA #> 10 45284 #> 11 45285 #> 12 45138"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_border.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a border — create_border","title":"Helper to create a border — create_border","text":"Border styles can following: \"thin\", \"thick\", \"slantDashDot\", \"none\", \"mediumDashed\", \"mediumDashDot\", \"medium\", \"hair\", \"double\", \"dotted\", \"dashed\", \"dashedDotDot\", \"dashDot\" Border colors can created wb_color()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_border.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a border — create_border","text":"","code":"create_border( diagonal_down = \"\", diagonal_up = \"\", outline = \"\", bottom = NULL, bottom_color = NULL, diagonal = NULL, diagonal_color = NULL, end = \"\", horizontal = \"\", left = NULL, left_color = NULL, right = NULL, right_color = NULL, start = \"\", top = NULL, top_color = NULL, vertical = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_border.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a border — create_border","text":"diagonal_down x diagonal_up x outline x bottom X bottom_color, diagonal_color, left_color, right_color, top_color color created wb_color() diagonal X end x, horizontal x left x right x start x top x vertical x ... x","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_cell_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a cell style — create_cell_style","title":"Helper to create a cell style — create_cell_style","text":"Create_cell_style wb_add_cell_style()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_cell_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a cell style — create_cell_style","text":"","code":"create_cell_style( border_id = \"\", fill_id = \"\", font_id = \"\", num_fmt_id = \"\", pivot_button = \"\", quote_prefix = \"\", xf_id = \"\", horizontal = \"\", indent = \"\", justify_last_line = \"\", reading_order = \"\", relative_indent = \"\", shrink_to_fit = \"\", text_rotation = \"\", vertical = \"\", wrap_text = \"\", ext_lst = \"\", hidden = \"\", locked = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_cell_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a cell style — create_cell_style","text":"border_id dummy fill_id dummy font_id dummy num_fmt_id numFmt ID builtin style pivot_button dummy quote_prefix dummy xf_id dummy horizontal alignment can \"\", \"center\", \"right\" indent dummy justify_last_line dummy reading_order dummy relative_indent dummy shrink_to_fit dummy text_rotation dummy vertical alignment can \"\", \"center\", \"right\" wrap_text dummy ext_lst dummy hidden dummy locked dummy ... reserved additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a comment — create_comment","title":"Create a comment — create_comment","text":"Use wb_comment() new code. See openxlsx2-deprecated","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a comment — create_comment","text":"","code":"create_comment( text, author = Sys.info()[[\"user\"]], style = NULL, visible = TRUE, width = 2, height = 4 )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a comment — create_comment","text":"text Comment text. Character vector. fmt_txt() string. author string, default, use \"user\" style Style object list style objects length comment vector. visible Default: TRUE. comment visible default? width Textbox integer width number cells height Textbox integer height number cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_comment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a comment — create_comment","text":"wbComment object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a custom formatting style — create_dxfs_style","title":"Create a custom formatting style — create_dxfs_style","text":"Create new style apply worksheet cells. Created styles assigned workbook use ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a custom formatting style — create_dxfs_style","text":"","code":"create_dxfs_style( font_name = NULL, font_size = NULL, font_color = NULL, num_fmt = NULL, border = NULL, border_color = wb_color(getOption(\"openxlsx2.borderColor\", \"black\")), border_style = getOption(\"openxlsx2.borderStyle\", \"thin\"), bg_fill = NULL, fg_color = NULL, gradient_fill = NULL, text_bold = NULL, text_strike = NULL, text_italic = NULL, text_underline = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a custom formatting style — create_dxfs_style","text":"font_name name font. Note font name validated. font_name NULL, workbook base_font used. (Defaults Calibri), see wb_get_base_font() font_size Font size. numeric greater 0. default, workbook base font size used. (Defaults 11) font_color Color text cell. valid hex color beginning \"#\" one colors(). font_color NULL, workbook base font colors used. (Defaults black) num_fmt Cell formatting. custom openxml format border NULL TRUE border_color \"black\" border_style \"thin\" bg_fill Cell background fill color. fg_color Cell foreground fill color. gradient_fill xml string beginning ... text_bold bold text_strike strikeout text_italic italic text_underline underline 1, true, single double ... Additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a custom formatting style — create_dxfs_style","text":"dxfs style node","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a custom formatting style — create_dxfs_style","text":"possible override border_color border_style {left, right, top, bottom}_color, {left, right, top, bottom}_style.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_dxfs_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a custom formatting style — create_dxfs_style","text":"","code":"# do not apply anything style1 <- create_dxfs_style() # change font color and background color style2 <- create_dxfs_style( font_color = wb_color(hex = \"FF9C0006\"), bgFill = wb_color(hex = \"FFFFC7CE\") ) # change font (type, size and color) and background # the old default in openxlsx and openxlsx2 <= 0.3 style3 <- create_dxfs_style( font_name = \"Calibri\", font_size = 11, font_color = wb_color(hex = \"FF9C0006\"), bgFill = wb_color(hex = \"FFFFC7CE\") ) ## See package vignettes for further examples"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_fill.html","id":null,"dir":"Reference","previous_headings":"","what":"create fill — create_fill","title":"create fill — create_fill","text":"create fill","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_fill.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create fill — create_fill","text":"","code":"create_fill( gradientFill = \"\", patternType = \"\", bgColor = NULL, fgColor = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_fill.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create fill — create_fill","text":"gradientFill complex fills patternType various: default \"none\", also \"solid\", color like \"gray125\" bgColor hex8 color alpha, red, green, blue patternFill fgColor hex8 color alpha, red, green, blue patternFill ... ...","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":null,"dir":"Reference","previous_headings":"","what":"create font format — create_font","title":"create font format — create_font","text":"create font format","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create font format — create_font","text":"","code":"create_font( b = \"\", charset = \"\", color = wb_color(hex = \"FF000000\"), condense = \"\", extend = \"\", family = \"2\", i = \"\", name = \"Calibri\", outline = \"\", scheme = \"minor\", shadow = \"\", strike = \"\", sz = \"11\", u = \"\", vert_align = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create font format — create_font","text":"b bold charset charset color rgb color: default \"FF000000\" condense condense extend extend family font family: default \"2\" italic name font name: default \"Calibri\" outline outline scheme font scheme: default \"minor\" shadow shadow strike strike sz font size: default \"11\", u underline vert_align vertical alignment ... ...","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_font.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create font format — create_font","text":"","code":"font <- create_font() # openxml has the alpha value leading hex8 <- unlist(xml_attr(read_xml(font), \"font\", \"color\")) hex8 <- paste0(\"#\", substr(hex8, 3, 8), substr(hex8, 1, 2)) # # write test color # col <- crayon::make_style(col2rgb(hex8, alpha = TRUE)) # cat(col(\"Test\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":null,"dir":"Reference","previous_headings":"","what":"Create Excel hyperlink string — create_hyperlink","title":"Create Excel hyperlink string — create_hyperlink","text":"Wrapper create internal hyperlink string pass write_formula(). Either link external URLs local files straight cells local Excel sheets.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create Excel hyperlink string — create_hyperlink","text":"","code":"create_hyperlink(sheet, row = 1, col = 1, text = NULL, file = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create Excel hyperlink string — create_hyperlink","text":"sheet Name worksheet row integer row number hyperlink link col column number letter hyperlink link text display text file Excel file name point . NULL hyperlink internal.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_hyperlink.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create Excel hyperlink string — create_hyperlink","text":"","code":"wb <- wb_workbook()$ add_worksheet(\"Sheet1\")$add_worksheet(\"Sheet2\")$add_worksheet(\"Sheet3\") ## Internal Hyperlink - create hyperlink formula manually x <- '=HYPERLINK(\\\"#Sheet2!B3\\\", \"Text to Display - Link to Sheet2\")' wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A1\") ## Internal - No text to display using create_hyperlink() function x <- create_hyperlink(sheet = \"Sheet3\", row = 1, col = 2) wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A2\") ## Internal - Text to display x <- create_hyperlink(sheet = \"Sheet3\", row = 1, col = 2,text = \"Link to Sheet 3\") wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A3\") ## Link to file - No text to display fl <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") x <- create_hyperlink(sheet = \"Sheet1\", row = 3, col = 10, file = fl) wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A4\") ## Link to file - Text to display fl <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") x <- create_hyperlink(sheet = \"Sheet2\", row = 3, col = 10, file = fl, text = \"Link to File.\") wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A5\") ## Link to external file - Text to display x <- '=HYPERLINK(\"[C:/Users]\", \"Link to an external file\")' wb$add_formula(sheet = \"Sheet1\", x = x, dims = \"A6\") x <- create_hyperlink(text = \"test.png\", file = \"D:/somepath/somepicture.png\") wb$add_formula(x = x, dims = \"A7\") # if (interactive()) wb$open()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_numfmt.html","id":null,"dir":"Reference","previous_headings":"","what":"create number format — create_numfmt","title":"create number format — create_numfmt","text":"create number format","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_numfmt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create number format — create_numfmt","text":"","code":"create_numfmt(numFmtId, formatCode)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_numfmt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create number format — create_numfmt","text":"numFmtId id, list can found Details create_cell_style() formatCode format code","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":null,"dir":"Reference","previous_headings":"","what":"Create sparklines object — create_sparklines","title":"Create sparklines object — create_sparklines","text":"Create sparkline added workbook wb_add_sparklines()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create sparklines object — create_sparklines","text":"","code":"create_sparklines( sheet = current_sheet(), dims, sqref, type = NULL, negative = NULL, displayEmptyCellsAs = \"gap\", markers = NULL, high = NULL, low = NULL, first = NULL, last = NULL, colorSeries = wb_color(hex = \"FF376092\"), colorNegative = wb_color(hex = \"FFD00000\"), colorAxis = wb_color(hex = \"FFD00000\"), colorMarkers = wb_color(hex = \"FFD00000\"), colorFirst = wb_color(hex = \"FFD00000\"), colorLast = wb_color(hex = \"FFD00000\"), colorHigh = wb_color(hex = \"FFD00000\"), colorLow = wb_color(hex = \"FFD00000\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create sparklines object — create_sparklines","text":"sheet sheet dims Cell range cells used create sparklines sqref Cell range destination sparklines. type type negative negative displayEmptyCellsAs displayEmptyCellsAs markers markers add marker line high highlight highest value low highlight lowest value first highlight first value last highlight last value colorSeries colorSeries colorNegative colorNegative colorAxis colorAxis colorMarkers colorMarkers colorFirst colorFirst colorLast colorLast colorHigh colorHigh colorLow colorLow","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create sparklines object — create_sparklines","text":"string containing XML code","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create sparklines object — create_sparklines","text":"Colors predefined rgb. Maybe theme colors can used .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_sparklines.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create sparklines object — create_sparklines","text":"","code":"# create sparklineGroup sparklines <- c( create_sparklines(\"Sheet 1\", \"A3:L3\", \"M3\", type = \"column\", first = \"1\"), create_sparklines(\"Sheet 1\", \"A2:L2\", \"M2\", markers = \"1\"), create_sparklines(\"Sheet 1\", \"A4:L4\", \"M4\", type = \"stacked\", negative = \"1\") ) t1 <- AirPassengers t2 <- do.call(cbind, split(t1, cycle(t1))) dimnames(t2) <- dimnames(.preformat.ts(t1)) wb <- wb_workbook()$ add_worksheet(\"Sheet 1\")$ add_data(x = t2)$ add_sparklines(sparklines = sparklines)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_tablestyle.html","id":null,"dir":"Reference","previous_headings":"","what":"create tableStyle — create_tablestyle","title":"create tableStyle — create_tablestyle","text":"Create custom table style. function expert use . Use styling functions instead.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_tablestyle.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create tableStyle — create_tablestyle","text":"","code":"create_tablestyle( name, whole_table = NULL, header_row = NULL, total_row = NULL, first_column = NULL, last_column = NULL, first_row_stripe = NULL, second_row_stripe = NULL, first_column_stripe = NULL, second_column_stripe = NULL, first_header_cell = NULL, last_header_cell = NULL, first_total_cell = NULL, last_total_cell = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/create_tablestyle.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create tableStyle — create_tablestyle","text":"name name whole_table wholeTable header_row headerRow total_row totalRow first_column firstColumn last_column lastColumn first_row_stripe firstRowStripe second_row_stripe secondRowStripe first_column_stripe firstColumnStripe second_column_stripe secondColumnStripe first_header_cell firstHeaderCell last_header_cell lastHeaderCell first_total_cell firstTotalCell last_total_cell lastTotalCell ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify creators of a workbook — creators-wb","title":"Modify creators of a workbook — creators-wb","text":"Modify get workbook creators","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify creators of a workbook — creators-wb","text":"","code":"wb_add_creators(wb, creators) wb_set_creators(wb, creators) wb_remove_creators(wb, creators) wb_get_creators(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify creators of a workbook — creators-wb","text":"wb wbWorkbook object creators character vector names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify creators of a workbook — creators-wb","text":"wb_set_creators(), wb_add_creators(), wb_remove_creators() return wbWorkbook object wb_get_creators() returns character vector creators","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/creators-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify creators of a workbook — creators-wb","text":"","code":"# workbook made with default creator (see [wbWorkbook]) wb <- wb_workbook() wb_get_creators(wb) #> [1] \"runner\" # add a new creator (assuming \"test\" isn't your default creator) wb <- wb_add_creators(wb, \"test\") wb_get_creators(wb) #> [1] \"runner\" \"test\" # remove the creator (should be the same as before) wb <- wb_remove_creators(wb, \"test\") wb_get_creators(wb) #> [1] \"runner\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":null,"dir":"Reference","previous_headings":"","what":"Create dimensions from dataframe — dataframe_to_dims","title":"Create dimensions from dataframe — dataframe_to_dims","text":"Use wb_dims()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create dimensions from dataframe — dataframe_to_dims","text":"","code":"dataframe_to_dims(df)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create dimensions from dataframe — dataframe_to_dims","text":"df dataframe spreadsheet columns rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dataframe_to_dims.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create dimensions from dataframe — dataframe_to_dims","text":"","code":"df <- dims_to_dataframe(\"A1:D5;F1:F6;D8\", fill = TRUE) dataframe_to_dims(df) #> [1] \"A1:D6;A8:D8;F1:F6;F8:F8\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/delete_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Delete data — delete_data","title":"Delete data — delete_data","text":"function deprecated. Use wb_clean_sheet().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/delete_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Delete data — delete_data","text":"","code":"delete_data(wb, sheet, cols, rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/delete_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Delete data — delete_data","text":"wb workbook sheet sheet clean cols numeric column vector rows numeric row vector","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper functions to work with dims — dims_helper","title":"Helper functions to work with dims — dims_helper","text":"Internal helpers (de)construct dims argument /row column vector. Exported user convenience.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper functions to work with dims — dims_helper","text":"","code":"dims_to_rowcol(x, as_integer = FALSE) rowcol_to_dims(row, col)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper functions to work with dims — dims_helper","text":"x dimension object \"A1\" \"A1:A1\" as_integer output returned integer, (defaults string) row numeric vector rows col numeric character vector cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper functions to work with dims — dims_helper","text":"dims string _to_dim .e \"A1:A1\" list rows columns to_rowcol","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_helper.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper functions to work with dims — dims_helper","text":"","code":"dims_to_rowcol(\"A1:J10\") #> [[1]] #> [1] \"A\" \"B\" \"C\" \"D\" \"E\" \"F\" \"G\" \"H\" \"I\" \"J\" #> #> [[2]] #> [1] \"1\" \"2\" \"3\" \"4\" \"5\" \"6\" \"7\" \"8\" \"9\" \"10\" #> wb_dims(1:10, 1:10) #> [1] \"A1:J10\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":null,"dir":"Reference","previous_headings":"","what":"Create dataframe from dimensions — dims_to_dataframe","title":"Create dataframe from dimensions — dims_to_dataframe","text":"Create dataframe dimensions","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create dataframe from dimensions — dims_to_dataframe","text":"","code":"dims_to_dataframe(dims, fill = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create dataframe from dimensions — dims_to_dataframe","text":"dims Character vector expected dimension. fill TRUE, fills dataframe variables","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/dims_to_dataframe.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create dataframe from dimensions — dims_to_dataframe","text":"","code":"dims_to_dataframe(\"A1:B2\") #> A B #> 1 #> 2 "},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Add/remove column filters in a worksheet — filter-wb","title":"Add/remove column filters in a worksheet — filter-wb","text":"Add remove excel column filters worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add/remove column filters in a worksheet — filter-wb","text":"","code":"wb_add_filter(wb, sheet = current_sheet(), rows, cols) wb_remove_filter(wb, sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add/remove column filters in a worksheet — filter-wb","text":"wb workbook object sheet worksheet name index. wb_remove_filter(), may supply vector worksheets. rows row number. cols columns add filter .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add/remove column filters in a worksheet — filter-wb","text":"Adds filters worksheet columns, with_filter = TRUE wb_add_data() wb_add_data_table() automatically adds filters first row table. NOTE Can single filter per worksheet unless using tables.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/filter-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add/remove column filters in a worksheet — filter-wb","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_worksheet(\"Sheet 3\") wb$add_data(1, iris) wb$add_filter(1, row = 1, cols = seq_along(iris)) ## Equivalently wb$add_data(2, x = iris, withFilter = TRUE) ## Similarly wb$add_data_table(3, iris) wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_worksheet(\"Sheet 3\") wb$add_data(1, iris) wb_add_filter(wb, 1, row = 1, cols = seq_along(iris)) ## Equivalently wb$add_data(2, x = iris, with_filter = TRUE) ## Similarly wb$add_data_table(3, iris) ## remove filters wb_remove_filter(wb, 1:2) ## remove filters wb_remove_filter(wb, 3) ## Does not affect tables!"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":null,"dir":"Reference","previous_headings":"","what":"format strings independent of the cell style. — fmt_txt","title":"format strings independent of the cell style. — fmt_txt","text":"format strings independent cell style.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"format strings independent of the cell style. — fmt_txt","text":"","code":"fmt_txt( x, bold = FALSE, italic = FALSE, underline = FALSE, strike = FALSE, size = NULL, color = NULL, font = NULL, charset = NULL, outline = NULL, vert_align = NULL ) # S3 method for fmt_txt +(x, y) # S3 method for fmt_txt as.character(x, ...) # S3 method for fmt_txt print(x, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"format strings independent of the cell style. — fmt_txt","text":"x, y openxlsx2 fmt_txt string bold bold italic italic underline underline strike strike size font size color wbColor color font font font name charset integer value table outline TRUE FALSE vert_align baseline, superscript, subscript ... additional arguments default print","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"format strings independent of the cell style. — fmt_txt","text":"result xml string. possible paste multiple fmt_txt() strings together create string differing styles. Using fmt_txt(charset = 161) give Greek Character Set can join additional objects fmt_txt() objects using \"+\". Though aware fmt_txt(\"sum:\") + (2 + 2) different fmt_txt(\"sum:\") + 2 + 2.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/fmt_txt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"format strings independent of the cell style. — fmt_txt","text":"","code":"fmt_txt(\"bar\", underline = TRUE) #> fmt_txt string: #> [1] \"bar\" fmt_txt(\"foo \", bold = TRUE) + fmt_txt(\"bar\") #> fmt_txt string: #> [1] \"foo bar\" as.character(fmt_txt(2)) #> [1] \"2\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Group rows and columns in a worksheet — grouping-wb","title":"Group rows and columns in a worksheet — grouping-wb","text":"Group selection rows cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Group rows and columns in a worksheet — grouping-wb","text":"","code":"wb_group_cols( wb, sheet = current_sheet(), cols, collapsed = FALSE, levels = NULL ) wb_ungroup_cols(wb, sheet = current_sheet(), cols) wb_group_rows( wb, sheet = current_sheet(), rows, collapsed = FALSE, levels = NULL ) wb_ungroup_rows(wb, sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Group rows and columns in a worksheet — grouping-wb","text":"wb wbWorkbook object sheet name index worksheet collapsed TRUE grouped columns collapsed levels levels rows, cols Indices rows columns group","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Group rows and columns in a worksheet — grouping-wb","text":"row previously hidden, now shown.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/grouping-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Group rows and columns in a worksheet — grouping-wb","text":"","code":"# create matrix t1 <- AirPassengers t2 <- do.call(cbind, split(t1, cycle(t1))) dimnames(t2) <- dimnames(.preformat.ts(t1)) wb <- wb_workbook() wb$add_worksheet(\"AirPass\") wb$add_data(\"AirPass\", t2, rowNames = TRUE) # groups will always end on/show the last row. in the example 1950, 1955, and 1960 wb <- wb_group_rows(wb, \"AirPass\", 2:3, collapsed = TRUE) # group years < 1950 wb <- wb_group_rows(wb, \"AirPass\", 4:8, collapsed = TRUE) # group years 1951-1955 wb <- wb_group_rows(wb, \"AirPass\", 9:13) # group years 1956-1960 wb <- wb_group_cols(wb, \"AirPass\", 2:4, collapsed = TRUE) wb <- wb_group_cols(wb, \"AirPass\", 5:7, collapsed = TRUE) wb <- wb_group_cols(wb, \"AirPass\", 8:10, collapsed = TRUE) wb <- wb_group_cols(wb, \"AirPass\", 11:13) ### create grouping levels grp_rows <- list( \"1\" = seq(2, 3), \"2\" = seq(4, 8), \"3\" = seq(9, 13) ) grp_cols <- list( \"1\" = seq(2, 4), \"2\" = seq(5, 7), \"3\" = seq(8, 10), \"4\" = seq(11, 13) ) wb <- wb_workbook() wb$add_worksheet(\"AirPass\") wb$add_data(\"AirPass\", t2, rowNames = TRUE) wb$group_cols(\"AirPass\", cols = grp_cols) wb$group_rows(\"AirPass\", rows = grp_rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert integer to Excel column — int2col","title":"Convert integer to Excel column — int2col","text":"Converts integer Excel column label.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert integer to Excel column — int2col","text":"","code":"int2col(x)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert integer to Excel column — int2col","text":"x numeric vector.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/int2col.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert integer to Excel column — int2col","text":"","code":"int2col(1:10) #> [1] \"A\" \"B\" \"C\" \"D\" \"E\" \"F\" \"G\" \"H\" \"I\" \"J\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify named regions in a worksheet — named_region-wb","title":"Modify named regions in a worksheet — named_region-wb","text":"Create / delete named region. can also specify named region using name argument wb_add_data(x = iris, name = \"-region\"). important note named regions case-sensitive must unique.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify named regions in a worksheet — named_region-wb","text":"","code":"wb_add_named_region( wb, sheet = current_sheet(), dims = \"A1\", name, local_sheet = FALSE, overwrite = FALSE, comment = NULL, hidden = NULL, custom_menu = NULL, description = NULL, is_function = NULL, function_group_id = NULL, help = NULL, local_name = NULL, publish_to_server = NULL, status_bar = NULL, vb_procedure = NULL, workbook_parameter = NULL, xml = NULL, ... ) wb_remove_named_region(wb, sheet = current_sheet(), name = NULL) wb_get_named_regions(wb, tables = FALSE, x = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify named regions in a worksheet — named_region-wb","text":"wb Workbook object sheet name index worksheet dims Worksheet cell range region (\"A1:D4\"). name Name region. character vector length 1. Note region names must case-insensitive unique. local_sheet TRUE named region local sheet overwrite Boolean. Overwrite exists? Default FALSE. comment description text named region hidden named region hidden? custom_menu, description, is_function, function_group_id, help, local_name, publish_to_server, status_bar, vb_procedure, workbook_parameter, xml Unknown XML feature ... additional arguments tables included data tables named regions result? x Deprecated. Use wb. Excel input use wb_load() first load xlsx file workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify named regions in a worksheet — named_region-wb","text":"workbook, invisibly. data frame named regions wb. NULL, none found.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify named regions in a worksheet — named_region-wb","text":"can use wb_dims() helper specify cell range named region","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/named_region-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify named regions in a worksheet — named_region-wb","text":"","code":"## create named regions wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") ## specify region wb$add_data(x = iris, start_col = 1, start_row = 1) wb$add_named_region( name = \"iris\", dims = wb_dims(x = iris) ) ## using add_data 'name' argument wb$add_data(sheet = 1, x = iris, name = \"iris2\", start_col = 10) ## delete one wb$remove_named_region(name = \"iris2\") wb$get_named_regions() #> name value sheets coords id local sheet #> 1 iris 'Sheet 1'!$A$1:$E$151 Sheet 1 A1:E151 1 0 1 ## read named regions df <- wb_to_df(wb, named_region = \"iris\") head(df) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 2 5.1 3.5 1.4 0.2 setosa #> 3 4.9 3.0 1.4 0.2 setosa #> 4 4.7 3.2 1.3 0.2 setosa #> 5 4.6 3.1 1.5 0.2 setosa #> 6 5.0 3.6 1.4 0.2 setosa #> 7 5.4 3.9 1.7 0.4 setosa # Extract named regions from a file out_file <- temp_xlsx() wb_save(wb, out_file, overwrite = TRUE) # Load the file as a workbook first, then get named regions. wb1 <- wb_load(out_file) wb1$get_named_regions() #> name value sheets coords id local sheet #> 1 iris 'Sheet 1'!$A$1:$E$151 Sheet 1 A1:E151 1 0 1"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":null,"dir":"Reference","previous_headings":"","what":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"functions provided compatibility older versions openxlsx2, may defunct soon next release. guide helps update code latest standards. openxlsx2 v1.0, API change minimal.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"internal-functions","dir":"Reference","previous_headings":"","what":"Internal functions","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"functions used internally openxlsx2. longer advertised use scripts. originate openxlsx, fit openxlsx2's API. able modify delete_data() -> wb_clean_sheet() write_comment() -> wb_add_comment() remove_comment() -> wb_remove_comment() write_formula() -> wb_add_formula() able change minimal changes","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"deprecated-functions","dir":"Reference","previous_headings":"","what":"Deprecated functions","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"First , can set option add warnings using deprecated functions.","code":"options(\"openxlsx2.soon_deprecated\" = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"argument-changes","dir":"Reference","previous_headings":"","what":"Argument changes","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"consistency, arguments renamed snake_case 0.8 release. now recommended use dims (cell range) favor row, col, start_row, start_col See wb_dims() provides many options provide cell range","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"functions-with-a-new-name","dir":"Reference","previous_headings":"","what":"Functions with a new name","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"functions renamed consistency. convertToExcelDate() -> convert_to_excel_date() wb_grid_lines() -> wb_set_grid_lines() create_comment() -> wb_comment()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-deprecated.html","id":"deprecated-usage","dir":"Reference","previous_headings":"","what":"Deprecated usage","title":"Deprecated functions in package openxlsx2 — openxlsx2-deprecated","text":"wb_get_named_regions() longer allow providing file.","code":"## Before wb_get_named_regions(file) ## Now wb <- wb_load(file) wb_get_named_regions(wb) # also possible wb_load(file)$get_named_regions()`"},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":null,"dir":"Reference","previous_headings":"","what":"xlsx reading, writing and editing. — openxlsx2-package","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"R package modern reinterpretation widely used popular openxlsx package. Similar predecessor, simplifies creation xlsx files providing clean interface writing, designing editing worksheets. Based powerful XML library focusing modern programming flows pipes chains, openxlsx2 allows break many new ground.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"default, openxlsx2 uses American English word color (written 'o' instead British English 'ou'). However, spellings supported. documentation uses 'color', function also accept 'colour'. However, indicated autocompletion.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"authors-and-contributions","dir":"Reference","previous_headings":"","what":"Authors and contributions","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"full list authors made package possible grateful, please see: feel like included list, please let us know. something contribute, welcome. something working expected, open issues solved issue, open pull request. Please respectful aware volunteers fun unpaid free time. work problems time need.","code":"system.file(\"AUTHORS\", package = \"openxlsx2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"license","dir":"Reference","previous_headings":"","what":"License","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"package licensed MIT license based openxlsx (Alexander Walker Philipp Schauberger; COPYRIGHT 2014-2022) pugixml (Arseny Kapoulkine; COPYRIGHT 2006-2022). released MIT license.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"xlsx reading, writing and editing. — openxlsx2-package","text":"Maintainer: Jan Marvin Garbuszus jan.garbuszus@ruhr-uni-bochum.de Authors: Jordan Mark Barbone jmbarbone@gmail.com (ORCID) contributors: Oliver Roy [contributor] openxlsx authors (openxlsx package) [copyright holder] Arseny Kapoulkine (Author included pugixml code) [contributor, copyright holder]","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/openxlsx2_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Options consulted by openxlsx2 — openxlsx2_options","title":"Options consulted by openxlsx2 — openxlsx2_options","text":"openxlsx2 package allows user set global options simplify formatting: built-defaults suit , set one options. Typically, done .Rprofile startup file options(\"openxlsx2.borderColor\" = \"black\") options(\"openxlsx2.borderStyle\" = \"thin\") options(\"openxlsx2.dateFormat\" = \"mm/dd/yyyy\") options(\"openxlsx2.datetimeFormat\" = \"yyyy-mm-dd hh:mm:ss\") options(\"openxlsx2.maxWidth\" = NULL) (Maximum width allowed Excel 250) options(\"openxlsx2.minWidth\" = NULL) options(\"openxlsx2.numFmt\" = NULL) options(\"openxlsx2.paperSize\" = 9) corresponds A4 paper size options(\"openxlsx2.orientation\" = \"portrait\") page orientation options(\"openxlsx2.sheet.default_name\" = \"Sheet\") options(\"openxlsx2.rightToLeft\" = NULL) options(\"openxlsx2.soon_deprecated\" = FALSE) Set TRUE want warning using functions deprecated recently openxlsx2 options(\"openxlsx2.creator\") default name creator new wbWorkbook object wb_workbook() new comments wb_add_comment() options(\"openxlsx2.thread_id\") default person id adding threaded comment cell wb_add_thread() options(\"openxlsx2.accountingFormat\" = 4) options(\"openxlsx2.commaFormat\" = 3) options(\"openxlsx2.percentageFormat\" = 10) options(\"openxlsx2.scientificFormat\" = 48)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/person-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper for adding threaded comments — person-wb","title":"Helper for adding threaded comments — person-wb","text":"Adds person workbook, can author threaded comments workbook wb_add_thread()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/person-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper for adding threaded comments — person-wb","text":"","code":"wb_add_person(wb, name = NULL, id = NULL, user_id = NULL, provider_id = \"None\") wb_get_person(wb, name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/person-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper for adding threaded comments — person-wb","text":"wb Workbook name name person display. id (optional) display id user_id (optional) user id provider_id (optional) provider id","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"print pugi_xml — print.pugi_xml","title":"print pugi_xml — print.pugi_xml","text":"print pugi_xml","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print pugi_xml — print.pugi_xml","text":"","code":"# S3 method for pugi_xml print(x, indent = \" \", raw = FALSE, attr_indent = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print pugi_xml — print.pugi_xml","text":"x something print indent indent used default \" \" raw print raw text attr_indent print attributes indented new line ... please check","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/print.pugi_xml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"print pugi_xml — print.pugi_xml","text":"","code":"# a pointer x <- read_xml(\"<\/a>\") print(x) #> #> #> <\/a> print(x, raw = TRUE) #> <\/a>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify workbook properties — properties-wb","title":"Modify workbook properties — properties-wb","text":"function useful workbooks loaded. can used set workbook title, subject category field. Use wb_workbook() easily set properties new workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify workbook properties — properties-wb","text":"","code":"wb_get_properties(wb) wb_set_properties( wb, creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), modifier = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify workbook properties — properties-wb","text":"wb Workbook object creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords, comments, manager, company Workbook property, string. datetime_created time workbook created modifier character string indicating last person modify workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify workbook properties — properties-wb","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify workbook properties — properties-wb","text":"set properties, following XML core properties used. title = dc:title subject = dc:subject creator = dc:creator keywords = cp:keywords comments = dc:description modifier = cp:lastModifiedBy datetime_created = dcterms:created datetime_modified = dcterms:modified category = cp:category addition, manager company used.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/properties-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify workbook properties — properties-wb","text":"","code":"file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb <- wb_load(file) wb$get_properties() #> creator modifier datetime_created #> \"Jan Marvin Garbuszus\" \"Jan Marvin Garbuszus\" \"2023-05-29T07:43:12Z\" #> datetime_modified company #> \"2023-05-29T10:47:37Z\" \"\" # Add a title to properties wb$set_properties(title = \"my title\") wb$get_properties() #> creator modifier datetime_created #> \"Jan Marvin Garbuszus\" \"Jan Marvin Garbuszus\" \"2023-11-23T20:02:30Z\" #> datetime_modified title company #> \"2023-05-29T10:47:37Z\" \"my title\" \"\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":null,"dir":"Reference","previous_headings":"","what":"xml_node — pugixml","title":"xml_node — pugixml","text":"returns xml values character","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"xml_node — pugixml","text":"","code":"xml_node(xml, level1 = NULL, level2 = NULL, level3 = NULL, ...) xml_node_name(xml, level1 = NULL, level2 = NULL, ...) xml_value(xml, level1 = NULL, level2 = NULL, level3 = NULL, ...) xml_attr(xml, level1 = NULL, level2 = NULL, level3 = NULL, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"xml_node — pugixml","text":"xml something xml level1 please check level2 please check level3 please check ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"xml_node — pugixml","text":"function returns XML nodes used openxlsx2. theory returned pointers well, yet implemented. level provided, nodes level1 returned","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/pugixml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"xml_node — pugixml","text":"","code":"x <- read_xml(\"<\/a>\") # return a xml_node(x, \"a\") #> [1] \"<\/a>\" # return b. requires the path to the node xml_node(x, \"a\", \"b\") #> [1] \"\" xml_node_name(\"\") #> [1] \"a\" xml_node_name(\"<\/a>\", \"a\") #> [1] \"b\" x <- read_xml(\"1<\/a>\") xml_value(x, \"a\") #> [1] \"1\" x <- read_xml(\"2<\/b><\/a>\") xml_value(x, \"a\", \"b\") #> [1] \"2\" x <- read_xml(\"1<\/a>\") xml_attr(x, \"a\") #> [[1]] #> a b #> \"1\" \"2\" #> x <- read_xml(\"2<\/b><\/a>\") xml_attr(x, \"a\", \"b\") #> [[1]] #> r #> \"1\" #> x <- read_xml(\"1<\/a>\") xml_attr(x, \"a\") #> [[1]] #> a b #> \"1\" \"2\" #> x <- read_xml(\"<\/b>\") xml_attr(x, \"b\", \"a\") #> [[1]] #> a b #> \"1\" \"2\" #>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"read xml file — read_xml","title":"read xml file — read_xml","text":"read xml file","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read xml file — read_xml","text":"","code":"read_xml( xml, pointer = TRUE, escapes = FALSE, declaration = FALSE, whitespace = TRUE, empty_tags = FALSE, skip_control = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read xml file — read_xml","text":"xml something read character string file pointer pointer returned? escapes bool characters like \"&\" escaped. default escapes. Assuming input already provides valid information. declaration declaration imported whitespace whitespace pcdata imported empty_tags <\/b> returned skip_control whitespace character exported","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"read xml file — read_xml","text":"Read xml files strings pointer checks input valid XML. input read character object, reevaluated every time called. pointer evaluated , lives lifetime R session gc().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/read_xml.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read xml file — read_xml","text":"","code":"# a pointer x <- read_xml(\"<\/a>\") print(x) #> #> #> <\/a> print(x, raw = TRUE) #> <\/a> str(x) #> Class 'pugi_xml' #> - attr(*, \"escapes\")= logi FALSE #> - attr(*, \"empty_tags\")= logi FALSE #> - attr(*, \"skip_control\")= logi TRUE # a character y <- read_xml(\"<\/a>\", pointer = FALSE) print(y) #> [1] \"<\/a>\" print(y, raw = TRUE) #> [1] \"<\/a>\" str(y) #> chr \"<\/a>\" # Errors if the import was unsuccessful try(z <- read_xml(\"\")) #> Error : xml import unsuccessful xml <- 'A & B<\/a>' # difference in escapes read_xml(xml, escapes = TRUE, pointer = FALSE) #> [1] \"A & B<\/a>\" read_xml(xml, escapes = FALSE, pointer = FALSE) #> [1] \"A & B<\/a>\" read_xml(xml, escapes = TRUE) #> A & B<\/a> read_xml(xml, escapes = FALSE) #> A & B<\/a> # read declaration read_xml(xml, declaration = TRUE) #> #> A & B<\/a>"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify row heights of a worksheet — row_heights-wb","title":"Modify row heights of a worksheet — row_heights-wb","text":"Set / remove custom worksheet row heights","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify row heights of a worksheet — row_heights-wb","text":"","code":"wb_set_row_heights( wb, sheet = current_sheet(), rows, heights = NULL, hidden = FALSE ) wb_remove_row_heights(wb, sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify row heights of a worksheet — row_heights-wb","text":"wb wbWorkbook object sheet name index worksheet. (vector accepted remove_row_heights()) rows Indices rows set / remove () custom height. heights Heights set rows specified spreadsheet column height units. hidden Option hide rows. logical vector length 1 length rows","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/row_heights-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify row heights of a worksheet — row_heights-wb","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\") ## set row heights wb <- wb_set_row_heights( wb, 1, rows = c(1, 4, 22, 2, 19), heights = c(24, 28, 32, 42, 33) ) ## overwrite row 1 height wb <- wb_set_row_heights(wb, 1, rows = 1, heights = 40) ## remove any custom row heights in row 1 wb$remove_row_heights(sheet = 1, rows = 1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Get / Set worksheet names for a workbook — sheet_names-wb","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"Gets / Sets worksheet names wbWorkbook object.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"","code":"wb_set_sheet_names(wb, old = NULL, new) wb_get_sheet_names(wb, escape = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"wb wbWorkbook object old name (index) old sheet name. NULL assume worksheets renamed. new name new sheet escape xml special characters escaped?","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"set_: wbWorkbook object. get_: named character vector sheet names order. names represent original value worksheet prior character substitutions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_names-wb.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get / Set worksheet names for a workbook — sheet_names-wb","text":"changes sheet name shown spreadsheet software alter elsewhere. formulas, chart references, named regions, pivot tables anywhere else.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"Get set worksheet visible state. allows hide worksheets workbook. visibility worksheet can either \"visible\", \"hidden\", \"veryHidden\". can set creating worksheet wb_add_worksheet(visible = FALSE)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"","code":"wb_get_sheet_visibility(wb) wb_set_sheet_visibility(wb, sheet = current_sheet(), value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"wb wbWorkbook object sheet Worksheet identifier value logical/character vector length sheet, providing character vector, can provide \"hidden\", \"visible\", \"veryHidden\"","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"wb_set_sheet_visibility: Workbook object, invisibly. wb_get_sheet_visibility(): character vector worksheet visibility value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/sheet_visibility-wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get/set worksheet visible state in a workbook — sheet_visibility-wb","text":"","code":"wb <- wb_workbook() wb$add_worksheet(sheet = \"S1\", visible = FALSE) wb$add_worksheet(sheet = \"S2\", visible = TRUE) wb$add_worksheet(sheet = \"S3\", visible = FALSE) wb$get_sheet_visibility() #> [1] \"hidden\" \"visible\" \"hidden\" wb$set_sheet_visibility(1, TRUE) ## show sheet 1 wb$set_sheet_visibility(2, FALSE) ## hide sheet 2 wb$set_sheet_visibility(3, \"hidden\") ## hide sheet 3 wb$set_sheet_visibility(3, \"veryHidden\") ## hide sheet 3 from UI"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/styles_on_sheet.html","id":null,"dir":"Reference","previous_headings":"","what":"get all styles on a sheet — styles_on_sheet","title":"get all styles on a sheet — styles_on_sheet","text":"get styles sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/styles_on_sheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get all styles on a sheet — styles_on_sheet","text":"","code":"styles_on_sheet(wb, sheet)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/styles_on_sheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get all styles on a sheet — styles_on_sheet","text":"wb workbook sheet worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/temp_xlsx.html","id":null,"dir":"Reference","previous_headings":"","what":"helper function to create temporary directory for testing purpose — temp_xlsx","title":"helper function to create temporary directory for testing purpose — temp_xlsx","text":"helper function create temporary directory testing purpose","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/temp_xlsx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"helper function to create temporary directory for testing purpose — temp_xlsx","text":"","code":"temp_xlsx(name = \"temp_xlsx\", macros = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/temp_xlsx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"helper function to create temporary directory for testing purpose — temp_xlsx","text":"name temp file macros logical file extension xlsm xlsx","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/waivers.html","id":null,"dir":"Reference","previous_headings":"","what":"openxlsx2 waivers — waivers","title":"openxlsx2 waivers — waivers","text":"Waiver functions openxlsx2 functions. current_sheet() uses wb_get_active_sheet() default performing actions worksheet, example add data. next_sheet() used add new worksheet, new chartsheet add pivot table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/waivers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"openxlsx2 waivers — waivers","text":"","code":"current_sheet() next_sheet() na_strings()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/waivers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"openxlsx2 waivers — waivers","text":"object class openxlsx2_waiver","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":null,"dir":"Reference","previous_headings":"","what":"R6 class for a workbook — wbWorkbook","title":"R6 class for a workbook — wbWorkbook","text":"workbook. documentation complete wrapper functions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"public-fields","dir":"Reference","previous_headings":"","what":"Public fields","title":"R6 class for a workbook — wbWorkbook","text":"sheet_names names sheets calcChain calcChain charts charts is_chartsheet logical vector identifying sheet chartsheet. customXml customXml connections connections ctrlProps ctrlProps Content_Types Content_Types app app core XML core custom custom drawings drawings drawings_rels drawings_rels embeddings embeddings externalLinks externalLinks externalLinksRels externalLinksRels headFoot header footer media media metadata contains cell/value metadata imported load xl/metadata.xml persons Persons workbook. used wb_add_thread() pivotTables pivotTables pivotTables.xml.rels pivotTables.xml.rels pivotDefinitions pivotDefinitions pivotRecords pivotRecords pivotDefinitionsRels pivotDefinitionsRels queryTables queryTables slicers slicers slicerCaches slicerCaches sharedStrings sharedStrings styles_mgr styles_mgr tables tables tables.xml.rels tables.xml.rels theme theme vbaProject vbaProject vml vml vml_rels vml_rels comments Comments (notes) present workbook. threadComments Threaded comments workbook workbook workbook.xml.rels workbook.xml.rels worksheets worksheets worksheets_rels worksheets_rels sheetOrder sheet order. Controls ordering worksheets worksheet names. path path","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook$new() wbWorkbook$append() wbWorkbook$append_sheets() wbWorkbook$validate_sheet() wbWorkbook$add_chartsheet() wbWorkbook$add_worksheet() wbWorkbook$clone_worksheet() wbWorkbook$add_data() wbWorkbook$add_data_table() wbWorkbook$add_pivot_table() wbWorkbook$add_slicer() wbWorkbook$add_formula() wbWorkbook$add_style() wbWorkbook$to_df() wbWorkbook$load() wbWorkbook$save() wbWorkbook$open() wbWorkbook$buildTable() wbWorkbook$update_table() wbWorkbook$copy_cells() wbWorkbook$get_base_font() wbWorkbook$set_base_font() wbWorkbook$set_bookview() wbWorkbook$get_sheet_names() wbWorkbook$set_sheet_names() wbWorkbook$set_row_heights() wbWorkbook$remove_row_heights() wbWorkbook$createCols() wbWorkbook$group_cols() wbWorkbook$ungroup_cols() wbWorkbook$remove_col_widths() wbWorkbook$set_col_widths() wbWorkbook$group_rows() wbWorkbook$ungroup_rows() wbWorkbook$remove_worksheet() wbWorkbook$add_data_validation() wbWorkbook$merge_cells() wbWorkbook$unmerge_cells() wbWorkbook$freeze_pane() wbWorkbook$add_comment() wbWorkbook$remove_comment() wbWorkbook$add_thread() wbWorkbook$add_conditional_formatting() wbWorkbook$add_image() wbWorkbook$add_plot() wbWorkbook$add_drawing() wbWorkbook$add_chart_xml() wbWorkbook$add_mschart() wbWorkbook$add_form_control() wbWorkbook$print() wbWorkbook$protect() wbWorkbook$protect_worksheet() wbWorkbook$get_properties() wbWorkbook$set_properties() wbWorkbook$set_creators() wbWorkbook$add_creators() wbWorkbook$remove_creators() wbWorkbook$set_last_modified_by() wbWorkbook$page_setup() wbWorkbook$set_header_footer() wbWorkbook$get_tables() wbWorkbook$remove_tables() wbWorkbook$add_filter() wbWorkbook$remove_filter() wbWorkbook$set_grid_lines() wbWorkbook$grid_lines() wbWorkbook$add_named_region() wbWorkbook$get_named_regions() wbWorkbook$remove_named_region() wbWorkbook$set_order() wbWorkbook$get_sheet_visibility() wbWorkbook$set_sheet_visibility() wbWorkbook$add_page_break() wbWorkbook$clean_sheet() wbWorkbook$add_border() wbWorkbook$add_fill() wbWorkbook$add_font() wbWorkbook$add_numfmt() wbWorkbook$add_cell_style() wbWorkbook$get_cell_style() wbWorkbook$set_cell_style() wbWorkbook$add_named_style() wbWorkbook$add_dxfs_style() wbWorkbook$clone_sheet_style() wbWorkbook$add_sparklines() wbWorkbook$add_ignore_error() wbWorkbook$set_sheetview() wbWorkbook$add_person() wbWorkbook$get_person() wbWorkbook$get_active_sheet() wbWorkbook$set_active_sheet() wbWorkbook$get_selected() wbWorkbook$set_selected() wbWorkbook$clone()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"R6 class for a workbook — wbWorkbook","text":"Creates new wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$new( creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creator character vector creators. Duplicated ignored. title, subject, category, keywords, comments, manager, company workbook properties datetime_created datetime (POSIXt) workbook created. Defaults current Sys.time() workbook object created, Excel files saved. theme Optional theme identified string number ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-append-","dir":"Reference","previous_headings":"","what":"Method append()","title":"R6 class for a workbook — wbWorkbook","text":"Append field. method intended internal use","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$append(field, value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"field valid field name value value field","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-append-sheets-","dir":"Reference","previous_headings":"","what":"Method append_sheets()","title":"R6 class for a workbook — wbWorkbook","text":"Append self$workbook$sheets method intended internal use","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$append_sheets(value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"value value self$workbook$sheets","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-validate-sheet-","dir":"Reference","previous_headings":"","what":"Method validate_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"validate sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$validate_sheet(sheet)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-3","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet character sheet name integer location","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"integer position sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-chartsheet-","dir":"Reference","previous_headings":"","what":"Method add_chartsheet()","title":"R6 class for a workbook — wbWorkbook","text":"Add chart sheet workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_chartsheet( sheet = next_sheet(), tab_color = NULL, zoom = 100, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-4","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet tab_color tab_color zoom zoom visible visible ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-2","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-worksheet-","dir":"Reference","previous_headings":"","what":"Method add_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"Add worksheet wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_worksheet( sheet = next_sheet(), grid_lines = TRUE, row_col_headers = TRUE, tab_color = NULL, zoom = 100, header = NULL, footer = NULL, odd_header = header, odd_footer = footer, even_header = header, even_footer = footer, first_header = header, first_footer = footer, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), has_drawing = FALSE, paper_size = getOption(\"openxlsx2.paperSize\", default = 9), orientation = getOption(\"openxlsx2.orientation\", default = \"portrait\"), hdpi = getOption(\"openxlsx2.hdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), vdpi = getOption(\"openxlsx2.vdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-5","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet grid_lines gridLines row_col_headers rowColHeaders tab_color tabColor zoom zoom header header footer footer odd_header oddHeader odd_footer oddFooter even_header evenHeader even_footer evenFooter first_header firstHeader first_footer firstFooter visible visible has_drawing hasDrawing paper_size paperSize orientation orientation hdpi hdpi vdpi vdpi ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-3","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clone-worksheet-","dir":"Reference","previous_headings":"","what":"Method clone_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"Clone workbooksheet another workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-6","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clone_worksheet( old = current_sheet(), new = next_sheet(), from = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-6","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"old name worksheet clone new name new worksheet add name new worksheet add","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-data-","dir":"Reference","previous_headings":"","what":"Method add_data()","title":"R6 class for a workbook — wbWorkbook","text":"add data","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-7","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_data( sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, col_names = TRUE, row_names = FALSE, with_filter = FALSE, name = NULL, sep = \", \", apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-7","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet x x dims Cell range sheet start_col startCol start_row startRow array array col_names colNames row_names rowNames with_filter withFilter name name sep sep apply_cell_style applyCellStyle remove_cell_style writing existing cells, cell style removed? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments return wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-data-table-","dir":"Reference","previous_headings":"","what":"Method add_data_table()","title":"R6 class for a workbook — wbWorkbook","text":"add data table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-8","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_data_table( sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, col_names = TRUE, row_names = FALSE, table_style = \"TableStyleLight9\", table_name = NULL, with_filter = TRUE, sep = \", \", first_column = FALSE, last_column = FALSE, banded_rows = TRUE, banded_cols = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-8","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet x x dims Cell range sheet start_col startCol start_row startRow col_names colNames row_names rowNames table_style tableStyle table_name tableName with_filter withFilter sep sep first_column firstColumn last_column lastColumn banded_rows bandedRows banded_cols bandedCols apply_cell_style applyCellStyle remove_cell_style writing existing cells, cell style removed? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-4","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-pivot-table-","dir":"Reference","previous_headings":"","what":"Method add_pivot_table()","title":"R6 class for a workbook — wbWorkbook","text":"add pivot table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-9","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_pivot_table( x, sheet = next_sheet(), dims = \"A3\", filter, rows, cols, data, fun, params, pivot_table, slicer )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-9","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"x wb_data object sheet name sheet dims worksheet cell pivot table placed filter character object names used filter rows character object names used rows cols character object names used cols data character object names used data fun character object functions used data params list parameters modify pivot table creation pivot_table character object name pivot table slicer character object names used slicer","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"R6 class for a workbook — wbWorkbook","text":"fun can either AVERAGE, COUNT, COUNTA, MAX, MIN, PRODUCT, STDEV, STDEVP, SUM, VAR, VARP","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-5","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-slicer-","dir":"Reference","previous_headings":"","what":"Method add_slicer()","title":"R6 class for a workbook — wbWorkbook","text":"add pivot table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-10","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_slicer( x, dims = \"A1\", sheet = current_sheet(), pivot_table, slicer, params )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-10","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"x wb_data object dims worksheet cell pivot table placed sheet name sheet pivot_table name pivot table selected sheet slicer variable used slicer pivot table params list parameters modify pivot table creation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-6","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-formula-","dir":"Reference","previous_headings":"","what":"Method add_formula()","title":"R6 class for a workbook — wbWorkbook","text":"Add formula","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-11","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_formula( sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, cm = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-11","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet x x dims Cell range sheet start_col startCol start_row startRow array array cm cm apply_cell_style applyCellStyle remove_cell_style writing existing cells, cell style removed? ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-7","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-style-","dir":"Reference","previous_headings":"","what":"Method add_style()","title":"R6 class for a workbook — wbWorkbook","text":"add style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-12","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_style(style = NULL, style_name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-12","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"style style style_name style_name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-8","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-to-df-","dir":"Reference","previous_headings":"","what":"Method to_df()","title":"R6 class for a workbook — wbWorkbook","text":"to_df","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-13","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$to_df( sheet, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, skip_hidden_rows = FALSE, skip_hidden_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, na.strings = \"#N/A\", na.numbers = NA, fill_merged_cells = FALSE, dims, show_formula = FALSE, convert = TRUE, types, named_region, keep_attributes = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-13","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet Either sheet name index. missing first sheet workbook selected. start_row first row begin looking data. start_col first column begin looking data. row_names TRUE, first col data used row names. col_names TRUE, first row data used column names. skip_empty_rows TRUE, empty rows skipped. skip_empty_cols TRUE, empty columns skipped. skip_hidden_rows TRUE, hidden rows skipped. skip_hidden_cols TRUE, hidden columns skipped. rows numeric vector specifying rows Excel file read. NULL, rows read. cols numeric vector specifying columns Excel file read. NULL, columns read. detect_dates TRUE, attempt recognize dates perform conversion. na.strings character vector strings interpreted NA. Blank cells returned NA. na.numbers numeric vector digits interpreted NA. Blank cells returned NA. fill_merged_cells TRUE, value merged cell given cells within merge. dims Character string type \"A1:B2\" optional dimensions imported. show_formula TRUE, underlying Excel formulas shown. convert TRUE, conversion dates numerics attempted. types named numeric indicating, type data. 0: character, 1: numeric, 2: date, 3: posixt, 4:logical. Names must match returned data named_region Character string named_region (defined name table). sheet selected, first appearance selected. keep_attributes TRUE additional attributes returned. (used internally define cell type.) ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-9","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"data frame","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-load-","dir":"Reference","previous_headings":"","what":"Method load()","title":"R6 class for a workbook — wbWorkbook","text":"load workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-14","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$load(file, sheet, data_only = FALSE, calc_chain = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-14","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"file file sheet name sheet data_only data_only calc_chain calc_chain ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-10","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-save-","dir":"Reference","previous_headings":"","what":"Method save()","title":"R6 class for a workbook — wbWorkbook","text":"Save workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-15","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$save(file = self$path, overwrite = TRUE, path = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-15","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"file path save workbook overwrite FALSE, overwrite path exists path Deprecated argument previously used file. Please use file new code.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-11","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-open-","dir":"Reference","previous_headings":"","what":"Method open()","title":"R6 class for a workbook — wbWorkbook","text":"open wbWorkbook Excel.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-16","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$open(interactive = NA)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-16","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"interactive FALSE throw warning open path. can manually set TRUE, otherwise NA (default) uses value returned base::interactive()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"details-1","dir":"Reference","previous_headings":"","what":"Details","title":"R6 class for a workbook — wbWorkbook","text":"minor helper wrapping xl_open entire thing","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-12","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-buildtable-","dir":"Reference","previous_headings":"","what":"Method buildTable()","title":"R6 class for a workbook — wbWorkbook","text":"Build table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-17","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$buildTable( sheet = current_sheet(), colNames, ref, showColNames, tableStyle, tableName, withFilter, totalsRowCount = 0, showFirstColumn = 0, showLastColumn = 0, showRowStripes = 1, showColumnStripes = 0 )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-17","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet colNames colNames ref ref showColNames showColNames tableStyle tableStyle tableName tableName withFilter withFilter totalsRowCount totalsRowCount showFirstColumn showFirstColumn showLastColumn showLastColumn showRowStripes showRowStripes showColumnStripes showColumnStripes","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-13","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheet object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-update-table-","dir":"Reference","previous_headings":"","what":"Method update_table()","title":"R6 class for a workbook — wbWorkbook","text":"update data_table","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-18","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$update_table(sheet = current_sheet(), dims = \"A1\", tabname)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-18","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet tabname tablename","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-14","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheet object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-copy-cells-","dir":"Reference","previous_headings":"","what":"Method copy_cells()","title":"R6 class for a workbook — wbWorkbook","text":"copy cells around workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-19","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$copy_cells( sheet = current_sheet(), dims = \"A1\", data, as_value = FALSE, as_ref = FALSE, transpose = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-19","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet data wb_data object as_value copy value written as_ref references cell written transpose data written transposed ... additional arguments passed add_data() used as_value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-15","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheet object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-base-font-","dir":"Reference","previous_headings":"","what":"Method get_base_font()","title":"R6 class for a workbook — wbWorkbook","text":"Get base font","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-20","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_base_font()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-16","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"list font","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-base-font-","dir":"Reference","previous_headings":"","what":"Method set_base_font()","title":"R6 class for a workbook — wbWorkbook","text":"Set base font","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-21","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_base_font( font_size = 11, font_color = wb_color(theme = \"1\"), font_name = \"Calibri\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-20","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"font_size fontSize font_color font_color font_name font_name ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-17","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-bookview-","dir":"Reference","previous_headings":"","what":"Method set_bookview()","title":"R6 class for a workbook — wbWorkbook","text":"Set book views","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-22","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_bookview( active_tab = NULL, auto_filter_date_grouping = NULL, first_sheet = NULL, minimized = NULL, show_horizontal_scroll = NULL, show_sheet_tabs = NULL, show_vertical_scroll = NULL, tab_ratio = NULL, visibility = NULL, window_height = NULL, window_width = NULL, x_window = NULL, y_window = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-21","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"active_tab activeTab auto_filter_date_grouping autoFilterDateGrouping first_sheet firstSheet minimized minimized show_horizontal_scroll showHorizontalScroll show_sheet_tabs showSheetTabs show_vertical_scroll showVerticalScroll tab_ratio tabRatio visibility visibility window_height windowHeight window_width windowWidth x_window xWindow y_window yWindow ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-18","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-sheet-names-","dir":"Reference","previous_headings":"","what":"Method get_sheet_names()","title":"R6 class for a workbook — wbWorkbook","text":"Get sheet names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-23","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_sheet_names(escape = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-22","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"escape Logical xml special characters escaped","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-19","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"named character vector sheet names order. names represent original value worksheet prior character substitutions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-sheet-names-","dir":"Reference","previous_headings":"","what":"Method set_sheet_names()","title":"R6 class for a workbook — wbWorkbook","text":"Sets sheet name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-24","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_sheet_names(old = NULL, new)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-23","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"old Old sheet name new New sheet name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-20","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-row-heights-","dir":"Reference","previous_headings":"","what":"Method set_row_heights()","title":"R6 class for a workbook — wbWorkbook","text":"Sets row height sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-25","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_row_heights( sheet = current_sheet(), rows, heights = NULL, hidden = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-24","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows heights heights hidden hidden","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-21","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-row-heights-","dir":"Reference","previous_headings":"","what":"Method remove_row_heights()","title":"R6 class for a workbook — wbWorkbook","text":"Removes row height sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-26","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_row_heights(sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-25","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-22","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-createcols-","dir":"Reference","previous_headings":"","what":"Method createCols()","title":"R6 class for a workbook — wbWorkbook","text":"creates column object worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-27","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$createCols(sheet = current_sheet(), n, beg, end)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-26","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet n n beg beg end end","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-group-cols-","dir":"Reference","previous_headings":"","what":"Method group_cols()","title":"R6 class for a workbook — wbWorkbook","text":"Group cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-28","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$group_cols( sheet = current_sheet(), cols, collapsed = FALSE, levels = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-27","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet cols cols collapsed collapsed levels levels","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-23","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-ungroup-cols-","dir":"Reference","previous_headings":"","what":"Method ungroup_cols()","title":"R6 class for a workbook — wbWorkbook","text":"ungroup cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-29","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$ungroup_cols(sheet = current_sheet(), cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-28","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet cols columns","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-24","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-col-widths-","dir":"Reference","previous_headings":"","what":"Method remove_col_widths()","title":"R6 class for a workbook — wbWorkbook","text":"Remove row heights worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-30","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_col_widths(sheet = current_sheet(), cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-29","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name index worksheet cols Indices columns remove custom width () .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-25","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-col-widths-","dir":"Reference","previous_headings":"","what":"Method set_col_widths()","title":"R6 class for a workbook — wbWorkbook","text":"Set column widths","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-31","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_col_widths( sheet = current_sheet(), cols, widths = 8.43, hidden = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-30","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet cols cols widths Width columns hidden logical vector determine cols hidden; values repeated across length cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-26","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-group-rows-","dir":"Reference","previous_headings":"","what":"Method group_rows()","title":"R6 class for a workbook — wbWorkbook","text":"Group rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-32","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$group_rows( sheet = current_sheet(), rows, collapsed = FALSE, levels = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-31","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows collapsed collapsed levels levels","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-27","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-ungroup-rows-","dir":"Reference","previous_headings":"","what":"Method ungroup_rows()","title":"R6 class for a workbook — wbWorkbook","text":"ungroup rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-33","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$ungroup_rows(sheet = current_sheet(), rows)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-32","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-28","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-worksheet-","dir":"Reference","previous_headings":"","what":"Method remove_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"Remove worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-34","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_worksheet(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-33","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet worksheet delete","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-29","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-data-validation-","dir":"Reference","previous_headings":"","what":"Method add_data_validation()","title":"R6 class for a workbook — wbWorkbook","text":"Adds data validation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-35","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_data_validation( sheet = current_sheet(), dims = \"A1\", type, operator, value, allow_blank = TRUE, show_input_msg = TRUE, show_error_msg = TRUE, error_style = NULL, error_title = NULL, error = NULL, prompt_title = NULL, prompt = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-34","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet type type operator operator value value allow_blank allowBlank show_input_msg showInputMsg show_error_msg showErrorMsg error_style icon shown options deal inputs. Default \"stop\" (cancel), else \"information\" (prompt popup) \"warning\" (prompt accept change input) error_title error title error error text prompt_title prompt title prompt prompt text ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-30","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-merge-cells-","dir":"Reference","previous_headings":"","what":"Method merge_cells()","title":"R6 class for a workbook — wbWorkbook","text":"Set cell merging sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-36","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$merge_cells( sheet = current_sheet(), dims = NULL, solve = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-35","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet solve logical intersecting cells solved ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-31","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-unmerge-cells-","dir":"Reference","previous_headings":"","what":"Method unmerge_cells()","title":"R6 class for a workbook — wbWorkbook","text":"Removes cell merging sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-37","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$unmerge_cells(sheet = current_sheet(), dims = NULL, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-36","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-32","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-freeze-pane-","dir":"Reference","previous_headings":"","what":"Method freeze_pane()","title":"R6 class for a workbook — wbWorkbook","text":"Set freeze panes sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-38","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$freeze_pane( sheet = current_sheet(), first_active_row = NULL, first_active_col = NULL, first_row = FALSE, first_col = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-37","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet first_active_row first_active_row first_active_col first_active_col first_row first_row first_col first_col ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-33","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-comment-","dir":"Reference","previous_headings":"","what":"Method add_comment()","title":"R6 class for a workbook — wbWorkbook","text":"Add comment","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-39","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_comment(sheet = current_sheet(), dims = \"A1\", comment, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-38","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims row column spreadsheet dimension, e.g. \"A1\" comment comment apply worksheet ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-34","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-comment-","dir":"Reference","previous_headings":"","what":"Method remove_comment()","title":"R6 class for a workbook — wbWorkbook","text":"Remove comment","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-40","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_comment(sheet = current_sheet(), dims = \"A1\", ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-39","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims row column spreadsheet dimension, e.g. \"A1\" ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-35","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-thread-","dir":"Reference","previous_headings":"","what":"Method add_thread()","title":"R6 class for a workbook — wbWorkbook","text":"add threaded comment worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-41","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_thread( sheet = current_sheet(), dims = \"A1\", comment = NULL, person_id, reply = FALSE, resolve = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-40","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet comment comment add person_id person Id added reply logical comment reply resolve logical comment marked resolved","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-conditional-formatting-","dir":"Reference","previous_headings":"","what":"Method add_conditional_formatting()","title":"R6 class for a workbook — wbWorkbook","text":"Add conditional formatting","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-42","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_conditional_formatting( sheet = current_sheet(), dims = NULL, rule = NULL, style = NULL, type = c(\"expression\", \"colorScale\", \"dataBar\", \"iconSet\", \"duplicatedValues\", \"uniqueValues\", \"containsErrors\", \"notContainsErrors\", \"containsBlanks\", \"notContainsBlanks\", \"containsText\", \"notContainsText\", \"beginsWith\", \"endsWith\", \"between\", \"topN\", \"bottomN\"), params = list(showValue = TRUE, gradient = TRUE, border = TRUE, percent = FALSE, rank = 5L), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-41","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet rule rule style style type type params Additional parameters ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-36","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-image-","dir":"Reference","previous_headings":"","what":"Method add_image()","title":"R6 class for a workbook — wbWorkbook","text":"Insert image sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-43","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_image( sheet = current_sheet(), dims = \"A1\", file, width = 6, height = 3, row_offset = 0, col_offset = 0, units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-42","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet file file width width height height row_offset, col_offset offsets units units dpi dpi ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-37","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-plot-","dir":"Reference","previous_headings":"","what":"Method add_plot()","title":"R6 class for a workbook — wbWorkbook","text":"Add plot. wrapper add_image()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-44","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_plot( sheet = current_sheet(), dims = \"A1\", width = 6, height = 4, row_offset = 0, col_offset = 0, file_type = \"png\", units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-43","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet width width height height row_offset, col_offset offsets file_type fileType units units dpi dpi ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-38","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-drawing-","dir":"Reference","previous_headings":"","what":"Method add_drawing()","title":"R6 class for a workbook — wbWorkbook","text":"Add xml drawing","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-45","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_drawing( sheet = current_sheet(), dims = \"A1\", xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-44","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet xml xml col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-39","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-chart-xml-","dir":"Reference","previous_headings":"","what":"Method add_chart_xml()","title":"R6 class for a workbook — wbWorkbook","text":"Add xml chart","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-46","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_chart_xml( sheet = current_sheet(), dims = NULL, xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-45","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet xml xml col_offset, row_offset positioning parameters ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-40","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-mschart-","dir":"Reference","previous_headings":"","what":"Method add_mschart()","title":"R6 class for a workbook — wbWorkbook","text":"Add mschart chart workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-47","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_mschart( sheet = current_sheet(), dims = NULL, graph, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-46","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims dimensions sheet appear graph mschart graph col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-41","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-form-control-","dir":"Reference","previous_headings":"","what":"Method add_form_control()","title":"R6 class for a workbook — wbWorkbook","text":"Add form control workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-48","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_form_control( sheet = current_sheet(), dims = \"A1\", type = c(\"Checkbox\", \"Radio\", \"Drop\"), text = NULL, link = NULL, range = NULL, checked = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-47","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet type type text text link link range range checked checked","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-42","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-print-","dir":"Reference","previous_headings":"","what":"Method print()","title":"R6 class for a workbook — wbWorkbook","text":"Prints wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-49","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$print()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-43","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly; called side-effects","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-protect-","dir":"Reference","previous_headings":"","what":"Method protect()","title":"R6 class for a workbook — wbWorkbook","text":"Protect workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-50","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$protect( protect = TRUE, password = NULL, lock_structure = FALSE, lock_windows = FALSE, type = 1, file_sharing = FALSE, username = unname(Sys.info()[\"user\"]), read_only_recommended = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-48","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"protect protect password password lock_structure lock_structure lock_windows lock_windows type type file_sharing file_sharing username username read_only_recommended read_only_recommended ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-44","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-protect-worksheet-","dir":"Reference","previous_headings":"","what":"Method protect_worksheet()","title":"R6 class for a workbook — wbWorkbook","text":"protect worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-51","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$protect_worksheet( sheet = current_sheet(), protect = TRUE, password = NULL, properties = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-49","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet protect protect password password properties character vector properties lock. Can one following: \"selectLockedCells\", \"selectUnlockedCells\", \"formatCells\", \"formatColumns\", \"formatRows\", \"insertColumns\", \"insertRows\", \"insertHyperlinks\", \"deleteColumns\", \"deleteRows\", \"sort\", \"autoFilter\", \"pivotTables\", \"objects\", \"scenarios\"","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-45","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-properties-","dir":"Reference","previous_headings":"","what":"Method get_properties()","title":"R6 class for a workbook — wbWorkbook","text":"Get properties workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-52","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_properties()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-properties-","dir":"Reference","previous_headings":"","what":"Method set_properties()","title":"R6 class for a workbook — wbWorkbook","text":"Set property workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-53","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_properties( creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), modifier = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-50","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creator character vector creators. Duplicated ignored. title, subject, category, datetime_created, modifier, keywords, comments, manager, company workbook property set","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-creators-","dir":"Reference","previous_headings":"","what":"Method set_creators()","title":"R6 class for a workbook — wbWorkbook","text":"Set creator(s)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-54","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_creators(creators)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-51","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creators character vector creators set. Duplicates ignored.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-creators-","dir":"Reference","previous_headings":"","what":"Method add_creators()","title":"R6 class for a workbook — wbWorkbook","text":"Add creator(s)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-55","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_creators(creators)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-52","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creators character vector creators add. Duplicates ignored.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-creators-","dir":"Reference","previous_headings":"","what":"Method remove_creators()","title":"R6 class for a workbook — wbWorkbook","text":"Remove creator(s)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-56","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_creators(creators)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-53","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"creators character vector creators remove. duplicated removed.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-last-modified-by-","dir":"Reference","previous_headings":"","what":"Method set_last_modified_by()","title":"R6 class for a workbook — wbWorkbook","text":"Change last modified ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-57","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_last_modified_by(name, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-54","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name new value ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-46","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-page-setup-","dir":"Reference","previous_headings":"","what":"Method page_setup()","title":"R6 class for a workbook — wbWorkbook","text":"page_setup()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-58","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$page_setup( sheet = current_sheet(), orientation = NULL, scale = 100, left = 0.7, right = 0.7, top = 0.75, bottom = 0.75, header = 0.3, footer = 0.3, fit_to_width = FALSE, fit_to_height = FALSE, paper_size = NULL, print_title_rows = NULL, print_title_cols = NULL, summary_row = NULL, summary_col = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-55","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet orientation orientation scale scale left left right right top top bottom bottom header header footer footer fit_to_width fitToWidth fit_to_height fitToHeight paper_size paperSize print_title_rows printTitleRows print_title_cols printTitleCols summary_row summaryRow summary_col summaryCol ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-47","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-header-footer-","dir":"Reference","previous_headings":"","what":"Method set_header_footer()","title":"R6 class for a workbook — wbWorkbook","text":"Sets headers footers","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-59","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_header_footer( sheet = current_sheet(), header = NULL, footer = NULL, even_header = NULL, even_footer = NULL, first_header = NULL, first_footer = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-56","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet header header footer footer even_header evenHeader even_footer evenFooter first_header firstHeader first_footer firstFooter ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-48","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-tables-","dir":"Reference","previous_headings":"","what":"Method get_tables()","title":"R6 class for a workbook — wbWorkbook","text":"get tables","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-60","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_tables(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-57","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-49","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"sheet tables. character() empty","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-tables-","dir":"Reference","previous_headings":"","what":"Method remove_tables()","title":"R6 class for a workbook — wbWorkbook","text":"remove tables","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-61","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_tables(sheet = current_sheet(), table, remove_data = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-58","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet table table remove_data removes data well","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-50","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-filter-","dir":"Reference","previous_headings":"","what":"Method add_filter()","title":"R6 class for a workbook — wbWorkbook","text":"add filters","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-62","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_filter(sheet = current_sheet(), rows, cols)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-59","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet rows rows cols cols","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-51","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-filter-","dir":"Reference","previous_headings":"","what":"Method remove_filter()","title":"R6 class for a workbook — wbWorkbook","text":"remove filters","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-63","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_filter(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-60","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-52","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-grid-lines-","dir":"Reference","previous_headings":"","what":"Method set_grid_lines()","title":"R6 class for a workbook — wbWorkbook","text":"grid lines","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-64","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_grid_lines(sheet = current_sheet(), show = FALSE, print = show)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-61","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet show show print print","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-53","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-grid-lines-","dir":"Reference","previous_headings":"","what":"Method grid_lines()","title":"R6 class for a workbook — wbWorkbook","text":"grid lines","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-65","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$grid_lines(sheet = current_sheet(), show = FALSE, print = show)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-62","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet show show print print","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-54","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-named-region-","dir":"Reference","previous_headings":"","what":"Method add_named_region()","title":"R6 class for a workbook — wbWorkbook","text":"add named region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-66","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_named_region( sheet = current_sheet(), dims = \"A1\", name, local_sheet = FALSE, overwrite = FALSE, comment = NULL, hidden = NULL, custom_menu = NULL, description = NULL, is_function = NULL, function_group_id = NULL, help = NULL, local_name = NULL, publish_to_server = NULL, status_bar = NULL, vb_procedure = NULL, workbook_parameter = NULL, xml = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-63","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet name name local_sheet local_sheet overwrite overwrite comment comment hidden hidden custom_menu custom_menu description description is_function function function_group_id function group id help help local_name localName publish_to_server publish server status_bar status bar vb_procedure vb procedure workbook_parameter workbookParameter xml xml ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-55","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-named-regions-","dir":"Reference","previous_headings":"","what":"Method get_named_regions()","title":"R6 class for a workbook — wbWorkbook","text":"get named regions workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-67","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_named_regions(tables = FALSE, x = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-64","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"tables Return tables well? x used.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-56","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"data.frame named regions","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-remove-named-region-","dir":"Reference","previous_headings":"","what":"Method remove_named_region()","title":"R6 class for a workbook — wbWorkbook","text":"remove named region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-68","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$remove_named_region(sheet = current_sheet(), name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-65","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet name name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-57","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-order-","dir":"Reference","previous_headings":"","what":"Method set_order()","title":"R6 class for a workbook — wbWorkbook","text":"set worksheet order","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-69","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_order(sheets)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-66","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheets sheets","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-58","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-sheet-visibility-","dir":"Reference","previous_headings":"","what":"Method get_sheet_visibility()","title":"R6 class for a workbook — wbWorkbook","text":"Get sheet visibility","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-70","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_sheet_visibility()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-59","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"Returns sheet visibility","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-sheet-visibility-","dir":"Reference","previous_headings":"","what":"Method set_sheet_visibility()","title":"R6 class for a workbook — wbWorkbook","text":"Set sheet visibility","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-71","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_sheet_visibility(sheet = current_sheet(), value)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-67","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet value value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-60","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-page-break-","dir":"Reference","previous_headings":"","what":"Method add_page_break()","title":"R6 class for a workbook — wbWorkbook","text":"Add page break","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-72","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_page_break(sheet = current_sheet(), row = NULL, col = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-68","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet row row col col","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-61","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clean-sheet-","dir":"Reference","previous_headings":"","what":"Method clean_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"clean sheet (remove values)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-73","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clean_sheet( sheet = current_sheet(), dims = NULL, numbers = TRUE, characters = TRUE, styles = TRUE, merged_cells = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-69","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet numbers remove numbers characters remove characters styles remove styles merged_cells remove merged_cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-62","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-border-","dir":"Reference","previous_headings":"","what":"Method add_border()","title":"R6 class for a workbook — wbWorkbook","text":"create borders cell region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-74","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_border( sheet = current_sheet(), dims = \"A1\", bottom_color = wb_color(hex = \"FF000000\"), left_color = wb_color(hex = \"FF000000\"), right_color = wb_color(hex = \"FF000000\"), top_color = wb_color(hex = \"FF000000\"), bottom_border = \"thin\", left_border = \"thin\", right_border = \"thin\", top_border = \"thin\", inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, inner_vcolor = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-70","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims dimensions worksheet e.g. \"A1\", \"A1:A5\", \"A1:H5\" bottom_color, left_color, right_color, top_color, inner_hcolor, inner_vcolor color, either something openxml knows RGB color left_border, right_border, top_border, bottom_border, inner_hgrid, inner_vgrid border style, NULL border drawn. See create_border possible border styles ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-63","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-fill-","dir":"Reference","previous_headings":"","what":"Method add_fill()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple fill function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-75","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_fill( sheet = current_sheet(), dims = \"A1\", color = wb_color(hex = \"FFFFFF00\"), pattern = \"solid\", gradient_fill = \"\", every_nth_col = 1, every_nth_row = 1, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-71","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet color colors apply, e.g. yellow: wb_color(hex = \"FFFFFF00\") pattern various default \"none\" others possible: \"solid\", \"mediumGray\", \"darkGray\", \"lightGray\", \"darkHorizontal\", \"darkVertical\", \"darkDown\", \"darkUp\", \"darkGrid\", \"darkTrellis\", \"lightHorizontal\", \"lightVertical\", \"lightDown\", \"lightUp\", \"lightGrid\", \"lightTrellis\", \"gray125\", \"gray0625\" gradient_fill gradient fill xml pattern. every_nth_col col filled every_nth_row row filled ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-64","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-font-","dir":"Reference","previous_headings":"","what":"Method add_font()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple font function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-76","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_font( sheet = current_sheet(), dims = \"A1\", name = \"Calibri\", color = wb_color(hex = \"FF000000\"), size = \"11\", bold = \"\", italic = \"\", outline = \"\", strike = \"\", underline = \"\", charset = \"\", condense = \"\", extend = \"\", family = \"\", scheme = \"\", shadow = \"\", vert_align = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-72","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet name font name: default \"Calibri\" color rgb color: default \"FF000000\" size font size: default \"11\", bold bold italic italic outline outline strike strike underline underline charset charset condense condense extend extend family font family scheme font scheme shadow shadow vert_align vertical alignment ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-65","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-numfmt-","dir":"Reference","previous_headings":"","what":"Method add_numfmt()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple number format function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-77","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_numfmt(sheet = current_sheet(), dims = \"A1\", numfmt)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-73","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet numfmt number format id character format","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-66","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-cell-style-","dir":"Reference","previous_headings":"","what":"Method add_cell_style()","title":"R6 class for a workbook — wbWorkbook","text":"provide simple cell style format function","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-78","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_cell_style( sheet = current_sheet(), dims = \"A1\", apply_alignment = NULL, apply_border = NULL, apply_fill = NULL, apply_font = NULL, apply_number_format = NULL, apply_protection = NULL, border_id = NULL, ext_lst = NULL, fill_id = NULL, font_id = NULL, hidden = NULL, horizontal = NULL, indent = NULL, justify_last_line = NULL, locked = NULL, num_fmt_id = NULL, pivot_button = NULL, quote_prefix = NULL, reading_order = NULL, relative_indent = NULL, shrink_to_fit = NULL, text_rotation = NULL, vertical = NULL, wrap_text = NULL, xf_id = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-74","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet apply_alignment logical apply alignment apply_border logical apply border apply_fill logical apply fill apply_font logical apply font apply_number_format logical apply number format apply_protection logical apply protection border_id border ID apply ext_lst extension list something like ...<\/extLst> fill_id fill ID apply font_id font ID apply hidden logical cell hidden horizontal align content horizontal ('left', 'center', 'right') indent logical indent content justify_last_line logical justify last line locked logical cell locked num_fmt_id number format ID apply pivot_button unknown quote_prefix unknown reading_order reading order left right relative_indent relative indentation shrink_to_fit logical shrink fit text_rotation degrees text rotation vertical vertical alignment content ('top', 'center', 'bottom') wrap_text wrap text cell xf_id xf ID apply ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-67","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-cell-style-","dir":"Reference","previous_headings":"","what":"Method get_cell_style()","title":"R6 class for a workbook — wbWorkbook","text":"get sheet style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-79","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_cell_style(sheet = current_sheet(), dims)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-75","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-68","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"character vector cell styles","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-cell-style-","dir":"Reference","previous_headings":"","what":"Method set_cell_style()","title":"R6 class for a workbook — wbWorkbook","text":"set sheet style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-80","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_cell_style(sheet = current_sheet(), dims, style)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-76","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet style style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-69","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-named-style-","dir":"Reference","previous_headings":"","what":"Method add_named_style()","title":"R6 class for a workbook — wbWorkbook","text":"set sheet style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-81","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_named_style( sheet = current_sheet(), dims = \"A1\", name = \"Normal\", font_name = NULL, font_size = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-77","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet name name font_name, font_size optional else default theme","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-70","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-dxfs-style-","dir":"Reference","previous_headings":"","what":"Method add_dxfs_style()","title":"R6 class for a workbook — wbWorkbook","text":"create dxfs style styles used conditional formatting custom table styles","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-82","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_dxfs_style( name, font_name = NULL, font_size = NULL, font_color = NULL, num_fmt = NULL, border = NULL, border_color = wb_color(getOption(\"openxlsx2.borderColor\", \"black\")), border_style = getOption(\"openxlsx2.borderStyle\", \"thin\"), bg_fill = NULL, gradient_fill = NULL, text_bold = NULL, text_italic = NULL, text_underline = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-78","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name style name font_name font name font_size font size font_color font color (wb_color() object) num_fmt number format border logical borders applied border_color border color border_style border style bg_fill background fill gradient_fill gradient fill text_bold logical text bold text_italic logical text italic text_underline logical text underlined ... additional arguments passed create_dxfs_style()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-71","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clone-sheet-style-","dir":"Reference","previous_headings":"","what":"Method clone_sheet_style()","title":"R6 class for a workbook — wbWorkbook","text":"clone style one sheet another","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-83","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clone_sheet_style(from = current_sheet(), to)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-79","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"worksheet cloning worksheet style applied ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-sparklines-","dir":"Reference","previous_headings":"","what":"Method add_sparklines()","title":"R6 class for a workbook — wbWorkbook","text":"apply sparkline worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-84","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_sparklines(sheet = current_sheet(), sparklines)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-80","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet sparklines sparkline created create_sparkline()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-ignore-error-","dir":"Reference","previous_headings":"","what":"Method add_ignore_error()","title":"R6 class for a workbook — wbWorkbook","text":"Ignore error worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-85","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_ignore_error( sheet = current_sheet(), dims = \"A1\", calculated_column = FALSE, empty_cell_reference = FALSE, eval_error = FALSE, formula = FALSE, formula_range = FALSE, list_data_validation = FALSE, number_stored_as_text = FALSE, two_digit_text_year = FALSE, unlocked_formula = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-81","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet dims Cell range sheet calculated_column calculatedColumn empty_cell_reference emptyCellReference eval_error evalError formula formula formula_range formulaRange list_data_validation listDataValidation number_stored_as_text numberStoredAsText two_digit_text_year twoDigitTextYear unlocked_formula unlockedFormula ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-sheetview-","dir":"Reference","previous_headings":"","what":"Method set_sheetview()","title":"R6 class for a workbook — wbWorkbook","text":"add sheetview","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-86","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_sheetview( sheet = current_sheet(), color_id = NULL, default_grid_color = NULL, right_to_left = NULL, show_formulas = NULL, show_grid_lines = NULL, show_outline_symbols = NULL, show_row_col_headers = NULL, show_ruler = NULL, show_white_space = NULL, show_zeros = NULL, tab_selected = NULL, top_left_cell = NULL, view = NULL, window_protection = NULL, workbook_view_id = NULL, zoom_scale = NULL, zoom_scale_normal = NULL, zoom_scale_page_layout_view = NULL, zoom_scale_sheet_layout_view = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-82","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet color_id, default_grid_color Integer: color, default 64 right_to_left Logical: TRUE column ordering right left show_formulas Logical: TRUE cell formulas shown show_grid_lines Logical: TRUE worksheet grid shown show_outline_symbols Logical: TRUE outline symbols shown show_row_col_headers Logical: TRUE row column headers shown show_ruler Logical: TRUE ruler shown page layout view show_white_space Logical: TRUE margins shown page layout view show_zeros Logical: FALSE cells containing zero shown blank !showFormulas tab_selected Integer: zero vector indicating selected tab top_left_cell Cell: cell shown top left corner / top right rightToLeft view View: \"normal\", \"pageBreakPreview\" \"pageLayout\" window_protection Logical: TRUE panes protected workbook_view_id integer: Pointing view inside workbook zoom_scale, zoom_scale_normal, zoom_scale_page_layout_view, zoom_scale_sheet_layout_view Integer: zoom scale 10 400. values current, normal etc. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"returns-72","dir":"Reference","previous_headings":"","what":"Returns","title":"R6 class for a workbook — wbWorkbook","text":"wbWorksheetObject, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-add-person-","dir":"Reference","previous_headings":"","what":"Method add_person()","title":"R6 class for a workbook — wbWorkbook","text":"add person workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-87","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$add_person( name = NULL, id = NULL, user_id = NULL, provider_id = \"None\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-83","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name name id id user_id user_id provider_id provider_id","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-person-","dir":"Reference","previous_headings":"","what":"Method get_person()","title":"R6 class for a workbook — wbWorkbook","text":"description get person","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-88","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_person(name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-84","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"name name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-active-sheet-","dir":"Reference","previous_headings":"","what":"Method get_active_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"description get active sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-89","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_active_sheet()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-active-sheet-","dir":"Reference","previous_headings":"","what":"Method set_active_sheet()","title":"R6 class for a workbook — wbWorkbook","text":"description set active sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-90","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_active_sheet(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-85","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-get-selected-","dir":"Reference","previous_headings":"","what":"Method get_selected()","title":"R6 class for a workbook — wbWorkbook","text":"description get selected sheets","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-91","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$get_selected()"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-set-selected-","dir":"Reference","previous_headings":"","what":"Method set_selected()","title":"R6 class for a workbook — wbWorkbook","text":"set selected sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-92","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$set_selected(sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-86","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"sheet name sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"R6 class for a workbook — wbWorkbook","text":"objects class cloneable method.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"usage-93","dir":"Reference","previous_headings":"","what":"Usage","title":"R6 class for a workbook — wbWorkbook","text":"","code":"wbWorkbook$clone(deep = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wbWorkbook.html","id":"arguments-87","dir":"Reference","previous_headings":"","what":"Arguments","title":"R6 class for a workbook — wbWorkbook","text":"deep Whether make deep clone.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify borders in a cell region of a worksheet — wb_add_border","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"wb wrapper create borders cell regions.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"","code":"wb_add_border( wb, sheet = current_sheet(), dims = \"A1\", bottom_color = wb_color(hex = \"FF000000\"), left_color = wb_color(hex = \"FF000000\"), right_color = wb_color(hex = \"FF000000\"), top_color = wb_color(hex = \"FF000000\"), bottom_border = \"thin\", left_border = \"thin\", right_border = \"thin\", top_border = \"thin\", inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, inner_vcolor = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"wb wbWorkbook sheet worksheet dims Cell range worksheet e.g. \"A1\", \"A1:A5\", \"A1:H5\" bottom_color, left_color, right_color, top_color, inner_hcolor, inner_vcolor color, either something openxml knows RGB color left_border, right_border, top_border, bottom_border, inner_hgrid, inner_vgrid border style, NULL border drawn. See create_border() possible border styles ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_border.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify borders in a cell region of a worksheet — wb_add_border","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb <- wb_add_border(wb, 1, dims = \"A1:K1\", left_border = NULL, right_border = NULL, top_border = NULL, bottom_border = \"double\") wb <- wb_add_border(wb, 1, dims = \"A5\", left_border = \"dotted\", right_border = \"dotted\", top_border = \"hair\", bottom_border = \"thick\") wb <- wb_add_border(wb, 1, dims = \"C2:C5\") wb <- wb_add_border(wb, 1, dims = \"G2:H3\") wb <- wb_add_border(wb, 1, dims = \"G12:H13\", left_color = wb_color(hex = \"FF9400D3\"), right_color = wb_color(hex = \"FF4B0082\"), top_color = wb_color(hex = \"FF0000FF\"), bottom_color = wb_color(hex = \"FF00FF00\")) wb <- wb_add_border(wb, 1, dims = \"A20:C23\") wb <- wb_add_border(wb, 1, dims = \"B12:D14\", left_color = wb_color(hex = \"FFFFFF00\"), right_color = wb_color(hex = \"FFFF7F00\"), bottom_color = wb_color(hex = \"FFFF0000\")) wb <- wb_add_border(wb, 1, dims = \"D28:E28\") # With chaining wb <- wb_workbook() wb$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_border(1, dims = \"A1:K1\", left_border = NULL, right_border = NULL, top_border = NULL, bottom_border = \"double\") wb$add_border(1, dims = \"A5\", left_border = \"dotted\", right_border = \"dotted\", top_border = \"hair\", bottom_border = \"thick\") wb$add_border(1, dims = \"C2:C5\") wb$add_border(1, dims = \"G2:H3\") wb$add_border(1, dims = \"G12:H13\", left_color = wb_color(hex = \"FF9400D3\"), right_color = wb_color(hex = \"FF4B0082\"), top_color = wb_color(hex = \"FF0000FF\"), bottom_color = wb_color(hex = \"FF00FF00\")) wb$add_border(1, dims = \"A20:C23\") wb$add_border(1, dims = \"B12:D14\", left_color = wb_color(hex = \"FFFFFF00\"), right_color = wb_color(hex = \"FFFF7F00\"), bottom_color = wb_color(hex = \"FFFF0000\")) wb$add_border(1, dims = \"D28:E28\") # if (interactive()) wb$open() wb <- wb_workbook() wb$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_border(1, dims = \"A2:K33\", inner_vgrid = \"thin\", inner_vcolor = c(rgb=\"FF808080\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the style in a cell region — wb_add_cell_style","title":"Modify the style in a cell region — wb_add_cell_style","text":"Add cell style cell region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the style in a cell region — wb_add_cell_style","text":"","code":"wb_add_cell_style( wb, sheet = current_sheet(), dims = \"A1\", apply_alignment = NULL, apply_border = NULL, apply_fill = NULL, apply_font = NULL, apply_number_format = NULL, apply_protection = NULL, border_id = NULL, ext_lst = NULL, fill_id = NULL, font_id = NULL, hidden = NULL, horizontal = NULL, indent = NULL, justify_last_line = NULL, locked = NULL, num_fmt_id = NULL, pivot_button = NULL, quote_prefix = NULL, reading_order = NULL, relative_indent = NULL, shrink_to_fit = NULL, text_rotation = NULL, vertical = NULL, wrap_text = NULL, xf_id = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the style in a cell region — wb_add_cell_style","text":"wb workbook sheet worksheet dims cell range apply_alignment logical apply alignment apply_border logical apply border apply_fill logical apply fill apply_font logical apply font apply_number_format logical apply number format apply_protection logical apply protection border_id border ID apply ext_lst extension list something like ...<\/extLst> fill_id fill ID apply font_id font ID apply hidden logical cell hidden horizontal align content horizontal ('left', 'center', 'right') indent logical indent content justify_last_line logical justify last line locked logical cell locked num_fmt_id number format ID apply pivot_button unknown quote_prefix unknown reading_order reading order left right relative_indent relative indentation shrink_to_fit logical shrink fit text_rotation degrees text rotation vertical vertical alignment content ('top', 'center', 'bottom') wrap_text wrap text cell xf_id xf ID apply ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the style in a cell region — wb_add_cell_style","text":"wbWorkbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_cell_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the style in a cell region — wb_add_cell_style","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", x = mtcars) wb %>% wb_add_cell_style( dims = \"A1:K1\", text_rotation = \"45\", horizontal = \"center\", vertical = \"center\", wrap_text = \"1\" ) # Chaining wb <- wb_workbook()$add_worksheet(\"S1\")$add_data(x = mtcars) wb$add_cell_style(dims = \"A1:K1\", text_rotation = \"45\", horizontal = \"center\", vertical = \"center\", wrap_text = \"1\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chart_xml.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a chart XML to a worksheet — wb_add_chart_xml","title":"Add a chart XML to a worksheet — wb_add_chart_xml","text":"Add chart XML worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chart_xml.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a chart XML to a worksheet — wb_add_chart_xml","text":"","code":"wb_add_chart_xml( wb, sheet = current_sheet(), dims = NULL, xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chart_xml.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a chart XML to a worksheet — wb_add_chart_xml","text":"wb workbook sheet sheet graph appear dims dimensions sheet appear xml chart xml col_offset, row_offset positioning ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chartsheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a chartsheet to a workbook — wb_add_chartsheet","title":"Add a chartsheet to a workbook — wb_add_chartsheet","text":"chartsheet special type sheet handles charts output. must add chart sheet. Otherwise, break workbook.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chartsheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a chartsheet to a workbook — wb_add_chartsheet","text":"","code":"wb_add_chartsheet( wb, sheet = next_sheet(), tab_color = NULL, zoom = 100, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_chartsheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a chartsheet to a workbook — wb_add_chartsheet","text":"wb Workbook object attach new chartsheet sheet name new chartsheet tab_color Color sheet tab. wb_color(), valid color (belonging grDevices::colors()) valid hex color beginning \"#\". zoom sheet zoom level, numeric 10 400 percentage. (zoom value smaller 10 default 10.) visible FALSE, sheet hidden else visible. ... Additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":null,"dir":"Reference","previous_headings":"","what":"Add comment to worksheet — wb_add_comment","title":"Add comment to worksheet — wb_add_comment","text":"Add comment worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add comment to worksheet — wb_add_comment","text":"","code":"wb_add_comment(wb, sheet = current_sheet(), dims = \"A1\", comment, ...) wb_remove_comment(wb, sheet = current_sheet(), dims = \"A1\", ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add comment to worksheet — wb_add_comment","text":"wb workbook object sheet worksheet workbook dims Optional row column spreadsheet dimension, e.g. \"A1\" comment comment apply dims created wb_comment(), string fmt_txt() object ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add comment to worksheet — wb_add_comment","text":"Workbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add comment to worksheet — wb_add_comment","text":"applying comment string, use wb_comment() default values.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_comment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add comment to worksheet — wb_add_comment","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") # add a comment without author c1 <- wb_comment(text = \"this is a comment\", author = \"\") wb$add_comment(dims = \"B10\", comment = c1) #' # Remove comment wb$remove_comment(sheet = \"Sheet 1\", dims = \"B10\") # Write another comment with author information c2 <- wb_comment(text = \"this is another comment\", author = \"Marco Polo\", visible = TRUE) wb$add_comment(sheet = 1, dims = \"C10\", comment = c2) # Works with formatted text also. formatted_text <- fmt_txt(\"bar\", underline = TRUE) wb$add_comment(dims = \"B5\", comment = formatted_text)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":null,"dir":"Reference","previous_headings":"","what":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"Add conditional formatting cells. can find details vignette(\"conditional-formatting\").","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"","code":"wb_add_conditional_formatting( wb, sheet = current_sheet(), dims = NULL, rule = NULL, style = NULL, type = c(\"expression\", \"colorScale\", \"dataBar\", \"iconSet\", \"duplicatedValues\", \"uniqueValues\", \"containsErrors\", \"notContainsErrors\", \"containsBlanks\", \"notContainsBlanks\", \"containsText\", \"notContainsText\", \"beginsWith\", \"endsWith\", \"between\", \"topN\", \"bottomN\"), params = list(showValue = TRUE, gradient = TRUE, border = TRUE, percent = FALSE, rank = 5L), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"wb Workbook object sheet name index worksheet dims cell cell range like \"A1\" \"A1:B2\" rule condition apply formatting. See Examples. style style apply cells satisfy rule. Default font_color = \"FF9C0006\" bg_fill = \"FFFFC7CE\" type type conditional formatting rule apply. One \"expression\", \"colorScale\" others mentioned Details. params list additional parameters passed. See Details . ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"openxml uses alpha channel first RGB, whereas usual default RGBA. Conditional formatting type accept different parameters. Unless noted, unlisted parameters ignored. expression [style] Style object[rule] Excel expression (character). Valid operators : <, <=, >, >=, ==, != colorScale [style] character vector valid colors length 2 3[rule]NULL character vector valid colors equal length styles dataBar [style] character vector valid colors length 2 3[rule] numeric vector specifying range databar colors. Must equal length style[params$showValue] FALSE cell value hidden. Default TRUE[params$gradient] FALSE color gradient removed. Default TRUE[params$border] FALSE border around database hidden. Default TRUE duplicatedValues / uniqueValues / containsErrors [style] Style object contains [style] Style object[rule] text look within cells [style] Style object.[rule] numeric vector length 2 specifying lower upper bound (Inclusive) topN [style] Style object[params$rank] numeric vector length 1 indicating number highest values. Default 5L[params$percent] TRUE, uses percentage bottomN [style] Style object[params$rank] numeric vector length 1 indicating number lowest values. Default 5L[params$percent] TRUE, uses percentage iconSet [params$showValue] FALSE, cell value hidden. Default TRUE[params$reverse] TRUE, order reversed. Default FALSE[params$percent] TRUE, uses percentage[params$iconSet] Uses one implemented icon sets. Values must match length icons set 3Arrows, 3ArrowsGray, 3Flags, 3Signs, 3Symbols, 3Symbols2, 3TrafficLights1, 3TrafficLights2, 4Arrows, 4ArrowsGray, 4Rating, 4RedToBlack, 4TrafficLights, 5Arrows, 5ArrowsGray, 5Quarters, 5Rating. default 3TrafficLights1.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_conditional_formatting.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add conditional formatting to cells in a worksheet — wb_add_conditional_formatting","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"a\") wb$add_data(x = 1:4, col_names = FALSE) wb$add_conditional_formatting(dims = wb_dims(cols = \"A\", rows = 1:4), rule = \">2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Add data to a worksheet — wb_add_data","title":"Add data to a worksheet — wb_add_data","text":"Add data worksheet optional styling.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add data to a worksheet — wb_add_data","text":"","code":"wb_add_data( wb, sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, col_names = TRUE, row_names = FALSE, with_filter = FALSE, name = NULL, sep = \", \", apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add data to a worksheet — wb_add_data","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x Object written. classes supported look examples. dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . array bool function written type array col_names TRUE, column names x written. row_names TRUE, row names x written. with_filter TRUE, add filters column name row. NOTE: can one filter per worksheet. name name named region specified. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add data to a worksheet — wb_add_data","text":"wbWorkbook, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add data to a worksheet — wb_add_data","text":"Formulae written using wb_add_formula() Workbook object get picked read_xlsx(). formula written left Excel evaluate formula file opened Excel. string \"_openxlsx_NA\" reserved openxlsx2. data frame contains string, output broken. Many base classes covered, though far third-party classes. data unknown class written, handled .character().","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add data to a worksheet — wb_add_data","text":"","code":"## See formatting vignette for further examples. ## Options for default styling (These are the defaults) options(\"openxlsx2.dateFormat\" = \"mm/dd/yyyy\") options(\"openxlsx2.datetimeFormat\" = \"yyyy-mm-dd hh:mm:ss\") options(\"openxlsx2.numFmt\" = NULL) ############################################################################# ## Create Workbook object and add worksheets wb <- wb_workbook() ## Add worksheets wb$add_worksheet(\"Cars\") wb$add_worksheet(\"Formula\") x <- mtcars[1:6, ] wb$add_data(\"Cars\", x, start_col = 2, start_row = 3, row_names = TRUE) ############################################################################# ## Hyperlinks ## - vectors/columns with class 'hyperlink' are written as hyperlinks' v <- rep(\"https://CRAN.R-project.org/\", 4) names(v) <- paste0(\"Hyperlink\", 1:4) # Optional: names will be used as display text class(v) <- \"hyperlink\" wb$add_data(\"Cars\", x = v, dims = \"B32\") ############################################################################# ## Formulas ## - vectors/columns with class 'formula' are written as formulas' df <- data.frame( x = 1:3, y = 1:3, z = paste(paste0(\"A\", 1:3 + 1L), paste0(\"B\", 1:3 + 1L), sep = \"+\"), stringsAsFactors = FALSE ) class(df$z) <- c(class(df$z), \"formula\") wb$add_data(sheet = \"Formula\", x = df) ############################################################################# # update cell range and add mtcars xlsxFile <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb2 <- wb_load(xlsxFile) # read dataset with inlinestr wb_to_df(wb2) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 wb2 <- wb2 %>% wb_add_data(sheet = 1, mtcars, dims = wb_dims(4, 4)) wb_to_df(wb2) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 NA #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA mpg cyl disp hp drat wt qsec vs #> 5 TRUE 2 21 6 160 1900-04-19 3.9 2.62 11:02:24 0 #> 6 FALSE 2 21 6 160 110 3.9 2.875 00:28:48 0 #> 7 FALSE 3 22.8 4 108 93 3.85 2.32 18.61 1 #> 8 FALSE 1 21.4 6 258 1900-04-19 3.08 3.215 10:33:36 1 #> 9 NA NA 18.7 8 360 175 3.15 3.44 17.02 0 #> 10 FALSE 2 18.1 6 225 1900-04-14 2.76 3.46 20.22 1 #> 11 FALSE 3 14.3 8 360 1900-09-01 3.21 3.57 15.84 0 #> 12 NA 1 24.4 4 146.7 1900-03-02 3.69 3.19 20 1 #> 13 NA NA 22.8 4 140.8 95 3.92 3.15 22.9 1 #> 14 NA NA 19.2 6 167.6 123 3.92 3.44 18.3 1 #> 15 NA NA 17.8 6 167.6 123 3.92 3.44 18.9 1 #> 16 NA NA 16.4 8 275.8 180 3.07 4.07 17.4 0 #> 17 NA NA 17.3 8 275.8 180 3.07 3.73 17.6 0 #> 18 NA NA 15.2 8 275.8 180 3.07 3.78 18 0 #> 19 NA NA 10.4 8 472 205 2.93 5.25 17.98 0 #> 20 NA NA 10.4 8 460 215 3 5.424 17.82 0 #> 21 NA NA 14.7 8 440 230 3.23 5.345 17.42 0 #> 22 NA NA 32.4 4 78.7 66 4.08 2.2 19.47 1 #> 23 NA NA 30.4 4 75.7 52 4.93 1.615 18.52 1 #> 24 NA NA 33.9 4 71.1 65 4.22 1.835 19.9 1 #> 25 NA NA 21.5 4 120.1 97 3.7 2.465 20.01 1 #> 26 NA NA 15.5 8 318 150 2.76 3.52 16.87 0 #> 27 NA NA 15.2 8 304 150 3.15 3.435 17.3 0 #> 28 NA NA 13.3 8 350 245 3.73 3.84 15.41 0 #> 29 NA NA 19.2 8 400 175 3.08 3.845 17.05 0 #> 30 NA NA 27.3 4 79 66 4.08 1.935 18.9 1 #> 31 NA NA 26 4 120.3 91 4.43 2.14 16.7 0 #> 32 NA NA 30.4 4 95.1 113 3.77 1.513 16.9 1 #> 33 NA NA 15.8 8 351 264 4.22 3.17 14.5 0 #> 34 NA NA 19.7 6 145 175 3.62 2.77 15.5 0 #> 35 NA NA 15 8 301 335 3.54 3.57 14.6 0 #> 36 NA NA 21.4 4 121 109 4.11 2.78 18.6 1 #> NA NA NA #> 3 #> 4 am gear carb #> 5 1 4 4 #> 6 1 4 4 #> 7 1 4 1 #> 8 0 3 1 #> 9 0 3 2 #> 10 0 3 1 #> 11 0 3 4 #> 12 0 4 2 #> 13 0 4 2 #> 14 0 4 4 #> 15 0 4 4 #> 16 0 3 3 #> 17 0 3 3 #> 18 0 3 3 #> 19 0 3 4 #> 20 0 3 4 #> 21 0 3 4 #> 22 1 4 1 #> 23 1 4 2 #> 24 1 4 1 #> 25 0 3 1 #> 26 0 3 2 #> 27 0 3 2 #> 28 0 3 4 #> 29 0 3 2 #> 30 1 4 1 #> 31 1 5 2 #> 32 1 5 2 #> 33 1 5 4 #> 34 1 5 6 #> 35 1 5 8 #> 36 1 4 2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a data table to a worksheet — wb_add_data_table","title":"Add a data table to a worksheet — wb_add_data_table","text":"Add data worksheet format Excel table.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a data table to a worksheet — wb_add_data_table","text":"","code":"wb_add_data_table( wb, sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, col_names = TRUE, row_names = FALSE, table_style = \"TableStyleLight9\", table_name = NULL, with_filter = TRUE, sep = \", \", first_column = FALSE, last_column = FALSE, banded_rows = TRUE, banded_cols = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a data table to a worksheet — wb_add_data_table","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x data frame dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . col_names TRUE, column names x written. row_names TRUE, row names x written. table_style table style name \"none\" (see vignette(\"openxlsx2_style_manual\")) table_name Name table workbook. table name must unique. with_filter TRUE, columns filters first row. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). options correspond Excel table options: first_column logical. TRUE, first column bold. last_column logical. TRUE, last column bold. banded_rows logical. TRUE, rows color banded. banded_cols logical. TRUE, columns color banded. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a data table to a worksheet — wb_add_data_table","text":"columns x class Date/POSIXt, currency, accounting, hyperlink, percentage automatically styled dates, currency, accounting, hyperlinks, percentages respectively. string \"_openxlsx_NA\" reserved openxlsx2. x contains string, output broken.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":null,"dir":"Reference","previous_headings":"","what":"Add data validation to cells in a worksheet — wb_add_data_validation","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"Add Excel data validation cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"","code":"wb_add_data_validation( wb, sheet = current_sheet(), dims = \"A1\", type, operator, value, allow_blank = TRUE, show_input_msg = TRUE, show_error_msg = TRUE, error_style = NULL, error_title = NULL, error = NULL, prompt_title = NULL, prompt = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"wb Workbook object sheet name index worksheet dims cell dimension (\"A1\" \"A1:B2\") type One 'whole', 'decimal', 'date', 'time', 'textLength', 'list' (see examples) operator One '', 'notBetween', 'equal', 'notEqual', 'greaterThan', 'lessThan', 'greaterThanOrEqual', 'lessThanOrEqual' value vector length 1 2 depending operator (see examples) allow_blank logical show_input_msg logical show_error_msg logical error_style icon shown options deal inputs. Default \"stop\" (cancel), else \"information\" (prompt popup) \"warning\" (prompt accept change input) error_title error title error error text prompt_title prompt title prompt prompt text ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_data_validation.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add data validation to cells in a worksheet — wb_add_data_validation","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_data_table(1, x = iris[1:30, ]) wb$add_data_validation(1, dims = \"A2:C31\", type = \"whole\", operator = \"between\", value = c(1, 9) ) wb$add_data_validation(1, dims = \"E2:E31\", type = \"textLength\", operator = \"between\", value = c(4, 6) ) ## Date and Time cell validation df <- data.frame( \"d\" = as.Date(\"2016-01-01\") + -5:5, \"t\" = as.POSIXct(\"2016-01-01\") + -5:5 * 10000 ) wb$add_data_table(2, x = df) wb$add_data_validation(2, dims = \"A2:A12\", type = \"date\", operator = \"greaterThanOrEqual\", value = as.Date(\"2016-01-01\") ) wb$add_data_validation(2, dims = \"B2:B12\", type = \"time\", operator = \"between\", value = df$t[c(4, 8)] ) ###################################################################### ## If type == 'list' # operator argument is ignored. wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_data_table(sheet = 1, x = iris[1:30, ]) wb$add_data(sheet = 2, x = sample(iris$Sepal.Length, 10)) wb$add_data_validation(1, dims = \"A2:A31\", type = \"list\", value = \"'Sheet 2'!$A$1:$A$10\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":null,"dir":"Reference","previous_headings":"","what":"Add drawings to a worksheet — wb_add_drawing","title":"Add drawings to a worksheet — wb_add_drawing","text":"Add drawings worksheet. requires rvg package.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add drawings to a worksheet — wb_add_drawing","text":"","code":"wb_add_drawing( wb, sheet = current_sheet(), dims = \"A1\", xml, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add drawings to a worksheet — wb_add_drawing","text":"wb wbWorkbook sheet sheet workbook dims dimension drawing added. xml drawing xml character file col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_drawing.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add drawings to a worksheet — wb_add_drawing","text":"","code":"if (requireNamespace(\"rvg\") && interactive()) { ## rvg example require(rvg) tmp <- tempfile(fileext = \".xml\") dml_xlsx(file = tmp) plot(1,1) dev.off() wb <- wb_workbook()$ add_worksheet()$ add_drawing(xml = tmp)$ add_drawing(xml = tmp, dims = NULL) } #> Loading required namespace: rvg"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Set a dxfs styling for the workbook — wb_add_dxfs_style","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"styles used conditional formatting custom table styles.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"","code":"wb_add_dxfs_style( wb, name, font_name = NULL, font_size = NULL, font_color = NULL, num_fmt = NULL, border = NULL, border_color = wb_color(getOption(\"openxlsx2.borderColor\", \"black\")), border_style = getOption(\"openxlsx2.borderStyle\", \"thin\"), bg_fill = NULL, gradient_fill = NULL, text_bold = NULL, text_italic = NULL, text_underline = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"wb Workbook object. name style name font_name font name font_size font size font_color font color (wb_color() object) num_fmt number format border logical borders applied border_color border color border_style border style bg_fill background fill gradient_fill gradient fill text_bold logical text bold text_italic logical text italic text_underline logical text underlined ... additional arguments passed create_dxfs_style()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"Workbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_dxfs_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set a dxfs styling for the workbook — wb_add_dxfs_style","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_dxfs_style( name = \"nay\", font_color = wb_color(hex = \"FF9C0006\"), bg_fill = wb_color(hex = \"FFFFC7CE\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the background fill color in a cell region — wb_add_fill","title":"Modify the background fill color in a cell region — wb_add_fill","text":"Add fill cell region.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the background fill color in a cell region — wb_add_fill","text":"","code":"wb_add_fill( wb, sheet = current_sheet(), dims = \"A1\", color = wb_color(hex = \"FFFFFF00\"), pattern = \"solid\", gradient_fill = \"\", every_nth_col = 1, every_nth_row = 1, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the background fill color in a cell region — wb_add_fill","text":"wb workbook sheet worksheet dims cell range color colors apply, e.g. yellow: wb_color(hex = \"FFFFFF00\") pattern various default \"none\" others possible: \"solid\", \"mediumGray\", \"darkGray\", \"lightGray\", \"darkHorizontal\", \"darkVertical\", \"darkDown\", \"darkUp\", \"darkGrid\", \"darkTrellis\", \"lightHorizontal\", \"lightVertical\", \"lightDown\", \"lightUp\", \"lightGrid\", \"lightTrellis\", \"gray125\", \"gray0625\" gradient_fill gradient fill xml pattern. every_nth_col col filled every_nth_row row filled ... ...","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the background fill color in a cell region — wb_add_fill","text":"wbWorkbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_fill.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the background fill color in a cell region — wb_add_fill","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb <- wb %>% wb_add_fill(\"S1\", dims = \"D5:J23\", color = wb_color(hex = \"FFFFFF00\")) wb <- wb %>% wb_add_fill(\"S1\", dims = \"B22:D27\", color = wb_color(hex = \"FF00FF00\")) wb <- wb %>% wb_add_worksheet(\"S2\") %>% wb_add_data(\"S2\", mtcars) gradient_fill1 <- ' <\/stop> <\/stop> <\/gradientFill>' wb <- wb %>% wb_add_fill(\"S2\", dims = \"A2:K5\", gradient_fill = gradient_fill1) gradient_fill2 <- ' <\/stop> <\/stop> <\/gradientFill>' wb <- wb %>% wb_add_fill(\"S2\", dims = \"A7:K10\", gradient_fill = gradient_fill2)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify font in a cell region — wb_add_font","title":"Modify font in a cell region — wb_add_font","text":"Modify font cell region precision can specify font cell cell styling functions, wb_add_font() gives control.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify font in a cell region — wb_add_font","text":"","code":"wb_add_font( wb, sheet = current_sheet(), dims = \"A1\", name = \"Calibri\", color = wb_color(hex = \"FF000000\"), size = \"11\", bold = \"\", italic = \"\", outline = \"\", strike = \"\", underline = \"\", charset = \"\", condense = \"\", extend = \"\", family = \"\", scheme = \"\", shadow = \"\", vert_align = \"\", ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify font in a cell region — wb_add_font","text":"wb Workbook object sheet worksheet dims cell range name Font name: default \"Calibri\" color object created wb_color() size Font size: default \"11\", bold bold, \"single\" \"double\", default: \"\" italic italic outline outline strike strike underline underline charset charset condense condense extend extend family font family scheme font scheme shadow shadow vert_align vertical alignment ... ...","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify font in a cell region — wb_add_font","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify font in a cell region — wb_add_font","text":"wb_add_font() provides options openxml accepts font node, set. Usually name, size color user wants.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_font.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify font in a cell region — wb_add_font","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb %>% wb_add_font(\"S1\", \"A1:K1\", name = \"Arial\", color = wb_color(theme = \"4\")) # With chaining wb <- wb_workbook()$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_font(\"S1\", \"A1:K1\", name = \"Arial\", color = wb_color(theme = \"4\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"can add Form Control cell. three supported types Checkbox, Radio button, Drop menu.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"","code":"wb_add_form_control( wb, sheet = current_sheet(), dims = \"A1\", type = c(\"Checkbox\", \"Radio\", \"Drop\"), text = NULL, link = NULL, range = NULL, checked = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"wb Workbook object sheet worksheet workbook dims single cell spreadsheet dimension, e.g. \"A1\". type type \"Checkbox\" (default), \"Radio\" radio button \"Drop\" drop menu text text shown next Checkbox radio button (optional) link cell range link range cell range used input checked logical indicating Checkbox Radio button checked","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_form_control.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a checkbox, radio button or drop menu to a cell in a worksheet — wb_add_form_control","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_form_control() # Add wb$add_form_control(dims = \"C5\", type = \"Radio\", checked = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a formula to a cell range in a worksheet — wb_add_formula","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"function can used add formula worksheet. wb_add_formula(), can provide formula character vector.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"","code":"wb_add_formula( wb, sheet = current_sheet(), x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, cm = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"wb Workbook object containing worksheet. sheet worksheet write . (either index name) x formula character vector. dims Spreadsheet dimensions determine x spans: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write . start_row vector specifying starting row write . array bool function written type array cm special kind array function hides curly braces cell. Add , see \"@\" inserted formulas. apply_cell_style write cell styles workbook? remove_cell_style keep cell style? ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"workbook, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"Currently, local translations formulas supported. English functions work. examples show small list possible formulas: SUM(B2:B4) AVERAGE(B2:B4) MIN(B2:B4) MAX(B2:B4) ...","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_formula.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a formula to a cell range in a worksheet — wb_add_formula","text":"","code":"wb <- wb_workbook()$add_worksheet() wb$add_data(dims = wb_dims(rows = 1, cols = 1:3), x = t(c(4, 5, 8)), col_names = FALSE) # calculate the sum of elements. wb$add_formula(dims = \"D1\", x = \"SUM(A1:C1)\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":null,"dir":"Reference","previous_headings":"","what":"Ignore error types on worksheet — wb_add_ignore_error","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"function allows hide / ignore certain types errors shown worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"","code":"wb_add_ignore_error( wb, sheet = current_sheet(), dims = \"A1\", calculated_column = FALSE, empty_cell_reference = FALSE, eval_error = FALSE, formula = FALSE, formula_range = FALSE, list_data_validation = FALSE, number_stored_as_text = FALSE, two_digit_text_year = FALSE, unlocked_formula = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"wb workbook sheet sheet name index. dims Cell range ignore error calculated_column calculatedColumn empty_cell_reference emptyCellReference eval_error evalError formula formula formula_range formulaRange list_data_validation listDataValidation number_stored_as_text TRUE, display error numbers stored text. two_digit_text_year twoDigitTextYear unlocked_formula unlockedFormula ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_ignore_error.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Ignore error types on worksheet — wb_add_ignore_error","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":null,"dir":"Reference","previous_headings":"","what":"Insert an image into a worksheet — wb_add_image","title":"Insert an image into a worksheet — wb_add_image","text":"Insert image worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Insert an image into a worksheet — wb_add_image","text":"","code":"wb_add_image( wb, sheet = current_sheet(), dims = \"A1\", file, width = 6, height = 3, row_offset = 0, col_offset = 0, units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Insert an image into a worksheet — wb_add_image","text":"wb workbook object sheet name index worksheet dims Dimensions plot. Default absolute anchor, single cell (eg. \"A1\") oneCellAnchor, cell range (eg. \"A1:D4\") twoCellAnchor file image file. Valid file types : \"jpeg\", \"png\", \"bmp\" width Width figure. height Height figure. row_offset offset vector one two cell anchor within cell (row) col_offset offset vector one two cell anchor within cell (column) units Units width height. Can \"\", \"cm\" \"px\" dpi Image resolution used conversion units. ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_image.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Insert an image into a worksheet — wb_add_image","text":"","code":"img <- system.file(\"extdata\", \"einstein.jpg\", package = \"openxlsx2\") wb <- wb_workbook()$ add_worksheet()$ add_image(\"Sheet 1\", dims = \"C5\", file = img, width = 6, height = 5)$ add_worksheet()$ add_image(dims = \"B2\", file = img)$ add_worksheet()$ add_image(dims = \"G3\", file = img, width = 15, height = 12, units = \"cm\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":null,"dir":"Reference","previous_headings":"","what":"Add mschart object to a worksheet — wb_add_mschart","title":"Add mschart object to a worksheet — wb_add_mschart","text":"Add mschart object worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add mschart object to a worksheet — wb_add_mschart","text":"","code":"wb_add_mschart( wb, sheet = current_sheet(), dims = NULL, graph, col_offset = 0, row_offset = 0, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add mschart object to a worksheet — wb_add_mschart","text":"wb workbook sheet sheet graph appear dims dimensions sheet appear graph mschart object col_offset, row_offset offsets column row ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_mschart.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add mschart object to a worksheet — wb_add_mschart","text":"","code":"if (requireNamespace(\"mschart\")) { require(mschart) ## Add mschart to worksheet (adds data and chart) scatter <- ms_scatterchart(data = iris, x = \"Sepal.Length\", y = \"Sepal.Width\", group = \"Species\") scatter <- chart_settings(scatter, scatterstyle = \"marker\") wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_mschart(dims = \"F4:L20\", graph = scatter) ## Add mschart to worksheet and use available data wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars, dims = \"B2\") # create wb_data object dat <- wb_data(wb, 1, dims = \"B2:E6\") # call ms_scatterplot data_plot <- ms_scatterchart( data = dat, x = \"mpg\", y = c(\"disp\", \"hp\"), labels = c(\"disp\", \"hp\") ) # add the scatterplot to the data wb <- wb %>% wb_add_mschart(dims = \"F4:L20\", graph = data_plot) } #> Loading required namespace: mschart #> Loading required package: mschart"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Apply styling to a cell region with a named style — wb_add_named_style","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"Set styling named style cell region. Use wb_add_cell_style() style cell region custom parameters. named style one spreadsheet software, like \"Normal\", \"Warning\".","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"","code":"wb_add_named_style( wb, sheet = current_sheet(), dims = \"A1\", name = \"Normal\", font_name = NULL, font_size = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"wb wbWorkbook object sheet worksheet dims cell range name named style name. font_name, font_size optional else default theme","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_named_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Apply styling to a cell region with a named style — wb_add_named_style","text":"wbWorkbook, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify number formatting in a cell region — wb_add_numfmt","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"Add number formatting cell region. can use number format created create_numfmt().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"","code":"wb_add_numfmt(wb, sheet = current_sheet(), dims = \"A1\", numfmt)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"wb Workbook sheet worksheet dims cell range numfmt either id character","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"list number formats ID located Details section create_cell_style().","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_numfmt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify number formatting in a cell region — wb_add_numfmt","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet(\"S1\") %>% wb_add_data(\"S1\", mtcars) wb %>% wb_add_numfmt(\"S1\", dims = \"F1:F33\", numfmt = \"#.0\") # Chaining wb <- wb_workbook()$add_worksheet(\"S1\")$add_data(\"S1\", mtcars) wb$add_numfmt(\"S1\", \"A1:A33\", numfmt = 1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a page break to a worksheet — wb_add_page_break","title":"Add a page break to a worksheet — wb_add_page_break","text":"Insert page breaks worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a page break to a worksheet — wb_add_page_break","text":"","code":"wb_add_page_break(wb, sheet = current_sheet(), row = NULL, col = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a page break to a worksheet — wb_add_page_break","text":"wb workbook object sheet name index worksheet row, col Either row number column number. One must NULL","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_page_break.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a page break to a worksheet — wb_add_page_break","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") wb$add_data(sheet = 1, x = iris) wb$add_page_break(sheet = 1, row = 10) wb$add_page_break(sheet = 1, row = 20) wb$add_page_break(sheet = 1, col = 2) ## In Excel: View tab -> Page Break Preview"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a pivot table to a worksheet — wb_add_pivot_table","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"Add pivot table worksheet. data must specified using wb_data() ensure function works.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"","code":"wb_add_pivot_table( wb, x, sheet = next_sheet(), dims = \"A3\", filter, rows, cols, data, fun, params, pivot_table, slicer )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"wb Workbook object containing #' worksheet. x data.frame inherits wb_data class. sheet worksheet containing #' dims worksheet cell pivot table placed filter column name(s) x used filter. rows column name(s) x used rows cols column names(s) x used cols data column name(s) x used data fun vector functions used data params list parameters modify pivot table creation. pivot_table optional name pivot table slicer character object names used slicer","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"fun can AVERAGE, COUNT, COUNTA, MAX, MIN, PRODUCT, STDEV, STDEVP, SUM, VAR, VARP. show_data_as can normal, difference, percent, percentDiff, runTotal, percentOfRow, percentOfCol, percentOfTotal, index. sheet empty unless opened spreadsheet software.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_pivot_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a pivot table to a worksheet — wb_add_pivot_table","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars) df <- wb_data(wb, sheet = 1) wb <- wb %>% wb_add_pivot_table(df, dims = \"A3\", filter = \"am\", rows = \"cyl\", cols = \"gear\", data = \"disp\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Insert the current plot into a worksheet — wb_add_plot","title":"Insert the current plot into a worksheet — wb_add_plot","text":"current plot saved temporary image file using grDevices::dev.copy() file written workbook using wb_add_image().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Insert the current plot into a worksheet — wb_add_plot","text":"","code":"wb_add_plot( wb, sheet = current_sheet(), dims = \"A1\", width = 6, height = 4, row_offset = 0, col_offset = 0, file_type = \"png\", units = \"in\", dpi = 300, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Insert the current plot into a worksheet — wb_add_plot","text":"wb workbook object sheet name index worksheet dims Worksheet dimension, single cell (\"A1\") cell range (\"A1:D4\") width Width figure. Defaults 6 . height Height figure . Defaults 4 . row_offset, col_offset Offset column row file_type File type image units Units width height. Can \"\", \"cm\" \"px\" dpi Image resolution ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Insert the current plot into a worksheet — wb_add_plot","text":"","code":"if (requireNamespace(\"ggplot2\") && interactive()) { ## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\", grid_lines = FALSE) ## create plot objects require(ggplot2) p1 <- ggplot(mtcars, aes(x = mpg, fill = as.factor(gear))) + ggtitle(\"Distribution of Gas Mileage\") + geom_density(alpha = 0.5) p2 <- ggplot(Orange, aes(x = age, y = circumference, color = Tree)) + geom_point() + geom_line() ## Insert currently displayed plot to sheet 1, row 1, column 1 print(p1) # plot needs to be showing wb$add_plot(1, width = 5, height = 3.5, file_type = \"png\", units = \"in\") ## Insert plot 2 print(p2) wb$add_plot(1, dims = \"J2\", width = 16, height = 10, file_type = \"png\", units = \"cm\") } #> Loading required namespace: ggplot2"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a slicer to a pivot table — wb_add_slicer","title":"Add a slicer to a pivot table — wb_add_slicer","text":"Add slicer previously created pivot table. function still experimental might changed/improved upcoming releases.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a slicer to a pivot table — wb_add_slicer","text":"","code":"wb_add_slicer( wb, x, dims = \"A1\", sheet = current_sheet(), pivot_table, slicer, params )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a slicer to a pivot table — wb_add_slicer","text":"wb Workbook object containing #' worksheet. x data.frame inherits wb_data class. dims worksheet cell pivot table placed sheet worksheet containing #' pivot_table name pivot table selected sheet slicer variable used slicer pivot table params list parameters modify pivot table creation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a slicer to a pivot table — wb_add_slicer","text":"assumes slicer variable initialization happened . Unfortunately, unlikely can guarantee loaded workbooks, strictly discourage users attempting . variable initialized properly, may cause spreadsheet software crash. time , slicer needs placed slide pivot table.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_slicer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a slicer to a pivot table — wb_add_slicer","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars) df <- wb_data(wb, sheet = 1) wb <- wb %>% wb_add_pivot_table( df, dims = \"A3\", slicer = \"vs\", rows = \"cyl\", cols = \"gear\", data = \"disp\", pivot_table = \"mtcars\" ) %>% wb_add_slicer(x = df, slicer = \"vs\", pivot_table = \"mtcars\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":null,"dir":"Reference","previous_headings":"","what":"Add sparklines to a worksheet — wb_add_sparklines","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"Add sparklines worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"","code":"wb_add_sparklines(wb, sheet = current_sheet(), sparklines)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"wb wbWorkbook sheet sheet add sparklines sparklines sparklines object created create_sparklines()","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_sparklines.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add sparklines to a worksheet — wb_add_sparklines","text":"","code":"sl <- create_sparklines(\"Sheet 1\", dims = \"A3:K3\", sqref = \"L3\") wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars) %>% wb_add_sparklines(sparklines = sl)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the default style in a workbook — wb_add_style","title":"Set the default style in a workbook — wb_add_style","text":"wb wrapper add style workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the default style in a workbook — wb_add_style","text":"","code":"wb_add_style(wb, style = NULL, style_name = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the default style in a workbook — wb_add_style","text":"wb workbook style style xml character, created create_*() function. style_name style name used optional argument","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the default style in a workbook — wb_add_style","text":"wbWorkbook object, invisibly.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set the default style in a workbook — wb_add_style","text":"","code":"yellow_f <- wb_color(hex = \"FF9C6500\") yellow_b <- wb_color(hex = \"FFFFEB9C\") yellow <- create_dxfs_style(font_color = yellow_f, bg_fill = yellow_b) wb <- wb_workbook() %>% wb_add_style(yellow)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":null,"dir":"Reference","previous_headings":"","what":"Add threaded comments to a cell in a worksheet — wb_add_thread","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"functions allow adding thread comments spreadsheets. yet supported spreadsheet software. threaded comment must tied person created wb_add_person().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"","code":"wb_add_thread( wb, sheet = current_sheet(), dims = \"A1\", comment = NULL, person_id, reply = FALSE, resolve = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"wb workbook sheet worksheet dims cell comment text add, character vector. person_id person Id added. default getOption(\"openxlsx2.thread_id\") set. reply comment reply? (default FALSE) resolve comment resolved? (default FALSE)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"threaded comment added, needs person attached . default create person provider id \"None\". providers possible specific values id user_id. require following, create workbook via spreadsheet software load get values wb_get_person()","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_thread.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add threaded comments to a cell in a worksheet — wb_add_thread","text":"","code":"wb <- wb_workbook()$add_worksheet() # Add a person to the workbook. wb$add_person(name = \"someone who likes to edit workbooks\") pid <- wb$get_person(name = \"someone who likes to edit workbooks\")$id # write a comment to a thread, reply to one and solve some wb <- wb %>% wb_add_thread(dims = \"A1\", comment = \"wow it works!\", person_id = pid) %>% wb_add_thread(dims = \"A2\", comment = \"indeed\", person_id = pid, resolve = TRUE) %>% wb_add_thread(dims = \"A1\", comment = \"so cool\", person_id = pid, reply = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a worksheet to a workbook — wb_add_worksheet","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"Add worksheet wbWorkbook first step build workbook. function, can also set sheet view zoom, set headers footers well features. See function arguments.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"","code":"wb_add_worksheet( wb, sheet = next_sheet(), grid_lines = TRUE, row_col_headers = TRUE, tab_color = NULL, zoom = 100, header = NULL, footer = NULL, odd_header = header, odd_footer = footer, even_header = header, even_footer = footer, first_header = header, first_footer = footer, visible = c(\"true\", \"false\", \"hidden\", \"visible\", \"veryhidden\"), has_drawing = FALSE, paper_size = getOption(\"openxlsx2.paperSize\", default = 9), orientation = getOption(\"openxlsx2.orientation\", default = \"portrait\"), hdpi = getOption(\"openxlsx2.hdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), vdpi = getOption(\"openxlsx2.vdpi\", default = getOption(\"openxlsx2.dpi\", default = 300)), ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"wb wbWorkbook object attach new worksheet sheet name new worksheet grid_lines logical. FALSE, worksheet grid lines hidden. row_col_headers logical. FALSE, worksheet colname rowname hidden. tab_color Color sheet tab. wb_color(), valid color (belonging grDevices::colors()) valid hex color beginning \"#\". zoom sheet zoom level, numeric 10 400 percentage. (zoom value smaller 10 default 10.) header, odd_header, even_header, first_header, footer, odd_footer, even_footer, first_footer Character vector length 3 corresponding positions left, center, right. header footer used default additional arguments. Setting even, odd, first, overrides header/footer. Use NA skip position. visible FALSE, sheet hidden else visible. has_drawing TRUE prepare drawing output (TODO work?) paper_size integer corresponding paper size. See wb_page_setup() details. orientation One \"portrait\" \"landscape\" hdpi, vdpi Horizontal vertical DPI. Can set options(\"openxlsx2.dpi\" = X), options(\"openxlsx2.hdpi\" = X) options(\"openxlsx2.vdpi\" = X) ... Additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"Headers footers can contain special tags &[Page] Page number &[Pages] Number pages &[Date] Current date &[Time] Current time &[Path] File path &[File] File name &[Tab] Worksheet name","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_add_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a worksheet to a workbook — wb_add_worksheet","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Add a worksheet wb$add_worksheet(\"Sheet 1\") ## No grid lines wb$add_worksheet(\"Sheet 2\", grid_lines = FALSE) ## A red tab color wb$add_worksheet(\"Sheet 3\", tab_color = wb_color(\"red\")) ## All options combined with a zoom of 40% wb$add_worksheet(\"Sheet 4\", grid_lines = FALSE, tab_color = wb_color(hex = \"#4F81BD\"), zoom = 40) ## Headers and Footers wb$add_worksheet(\"Sheet 5\", header = c(\"ODD HEAD LEFT\", \"ODD HEAD CENTER\", \"ODD HEAD RIGHT\"), footer = c(\"ODD FOOT RIGHT\", \"ODD FOOT CENTER\", \"ODD FOOT RIGHT\"), even_header = c(\"EVEN HEAD LEFT\", \"EVEN HEAD CENTER\", \"EVEN HEAD RIGHT\"), even_footer = c(\"EVEN FOOT RIGHT\", \"EVEN FOOT CENTER\", \"EVEN FOOT RIGHT\"), first_header = c(\"TOP\", \"OF FIRST\", \"PAGE\"), first_footer = c(\"BOTTOM\", \"OF FIRST\", \"PAGE\") ) wb$add_worksheet(\"Sheet 6\", header = c(\"&[Date]\", \"ALL HEAD CENTER 2\", \"&[Page] / &[Pages]\"), footer = c(\"&[Path]&[File]\", NA, \"&[Tab]\"), first_header = c(NA, \"Center Header of First Page\", NA), first_footer = c(NA, \"Center Footer of First Page\", NA) ) wb$add_worksheet(\"Sheet 7\", header = c(\"ALL HEAD LEFT 2\", \"ALL HEAD CENTER 2\", \"ALL HEAD RIGHT 2\"), footer = c(\"ALL FOOT RIGHT 2\", \"ALL FOOT CENTER 2\", \"ALL FOOT RIGHT 2\") ) wb$add_worksheet(\"Sheet 8\", first_header = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\"), first_footer = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\") ) ## Need data on worksheet to see all headers and footers wb$add_data(sheet = 5, 1:400) wb$add_data(sheet = 6, 1:400) wb$add_data(sheet = 7, 1:400) wb$add_data(sheet = 8, 1:400)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Apply styling to a cell region — wb_cell_style","title":"Apply styling to a cell region — wb_cell_style","text":"Apply styling cell region","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Apply styling to a cell region — wb_cell_style","text":"","code":"wb_get_cell_style(wb, sheet = current_sheet(), dims) wb_set_cell_style(wb, sheet = current_sheet(), dims, style)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Apply styling to a cell region — wb_cell_style","text":"wb wbWorkbook object sheet sheet dims cell range worksheet style style","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Apply styling to a cell region — wb_cell_style","text":"wb_get_cell_style returns style id character wb_set_cell_style returns workbook invisibly.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_cell_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Apply styling to a cell region — wb_cell_style","text":"","code":"# set a style in b1 wb <- wb_workbook()$add_worksheet()$ add_numfmt(dims = \"B1\", numfmt = \"#,0\") # get style from b1 to assign it to a1 numfmt <- wb$get_cell_style(dims = \"B1\") # assign style to a1 wb$set_cell_style(dims = \"A1\", style = numfmt)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove all values in a worksheet — wb_clean_sheet","title":"Remove all values in a worksheet — wb_clean_sheet","text":"Remove content worksheet completely, region specifying dims.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove all values in a worksheet — wb_clean_sheet","text":"","code":"wb_clean_sheet( wb, sheet = current_sheet(), dims = NULL, numbers = TRUE, characters = TRUE, styles = TRUE, merged_cells = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove all values in a worksheet — wb_clean_sheet","text":"wb Workbook object sheet sheet clean dims spreadsheet dimensions (optional) numbers remove numbers characters remove characters styles remove styles merged_cells remove merged_cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clean_sheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove all values in a worksheet — wb_clean_sheet","text":"Workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_sheet_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","title":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","text":"function can used apply styling cell range, apply another cell range.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_sheet_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","text":"","code":"wb_clone_sheet_style(wb, from = current_sheet(), to)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_sheet_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Apply styling from a sheet to another within a workbook — wb_clone_sheet_style","text":"wb workbook sheet select style sheet apply style ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Create copies of a worksheet within a workbook — wb_clone_worksheet","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"Create copy worksheet wbWorkbook object. Cloning possible limited extent. References sheet names formulas, charts, pivot tables, etc. may updated. elements like named ranges slicers cloned yet. Cloning another workbook still experimental feature might work reliably. Cloning data, media, charts tables work. Slicers pivot tables well everything everything relying dxfs styles (e.g. custom table styles conditional formatting) currently implemented. Formula references updated reflect interactions workbooks.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"","code":"wb_clone_worksheet(wb, old = current_sheet(), new = next_sheet(), from = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"wb wbWorkbook object old Name existing worksheet copy new Name new worksheet create (optional) Workbook clone old ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"wbWorkbook object, invisibly.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_clone_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create copies of a worksheet within a workbook — wb_clone_worksheet","text":"","code":"# Create a new workbook wb <- wb_workbook() # Add worksheets wb$add_worksheet(\"Sheet 1\") wb$clone_worksheet(\"Sheet 1\", new = \"Sheet 2\") # Take advantage of waiver functions wb$clone_worksheet(old = \"Sheet 1\") ## cloning from another workbook # create a workbook wb <- wb_workbook()$ add_worksheet(\"NOT_SUM\")$ add_data(x = head(iris))$ add_fill(dims = \"A1:B2\", color = wb_color(\"yellow\"))$ add_border(dims = \"B2:C3\") # we will clone this styled chart into another workbook fl <- system.file(\"extdata\", \"oxlsx2_sheet.xlsx\", package = \"openxlsx2\") wb_from <- wb_load(fl) # clone styles and shared strings wb$clone_worksheet(old = \"SUM\", new = \"SUM\", from = wb_from)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a color — wb_color","title":"Helper to create a color — wb_color","text":"Creates wbColour object.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a color — wb_color","text":"","code":"wb_color( name = NULL, auto = NULL, indexed = NULL, hex = NULL, theme = NULL, tint = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a color — wb_color","text":"name name color known R auto boolean. indexed indexed color values. hex rgb color ARGB hex value \"FF000000\". theme zero based index referencing value theme. tint tint value applied. Range -1 (dark) 1 (light).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper to create a color — wb_color","text":"wbColour object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to create a comment object — wb_comment","title":"Helper to create a comment object — wb_comment","text":"Creates wbComment object. Use wb_add_comment() add worksheet location.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to create a comment object — wb_comment","text":"","code":"wb_comment( text = NULL, style = NULL, visible = FALSE, author = getOption(\"openxlsx2.creator\"), width = 2, height = 4 )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to create a comment object — wb_comment","text":"text Comment text. Character vector. fmt_txt() string. style Style object list style objects length comment vector. visible comment visible? Default: FALSE. author Author comment. string. default, look options(\"openxlsx2.creator\"). Otherwise, check system username. width Textbox integer width number cells height Textbox integer height number cells","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper to create a comment object — wb_comment","text":"wbComment object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_comment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper to create a comment object — wb_comment","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\") # write comment without author c1 <- wb_comment(text = \"this is a comment\", author = \"\", visible = TRUE) wb$add_comment(dims = \"B10\", comment = c1) # Write another comment with author information c2 <- wb_comment(text = \"this is another comment\", author = \"Marco Polo\") wb$add_comment(sheet = 1, dims = \"C10\", comment = c2) # write a styled comment with system author s1 <- create_font(b = \"true\", color = wb_color(hex = \"FFFF0000\"), sz = \"12\") s2 <- create_font(color = wb_color(hex = \"FF000000\"), sz = \"9\") c3 <- wb_comment(text = c(\"This Part Bold red\\n\\n\", \"This part black\"), style = c(s1, s2)) wb$add_comment(sheet = 1, dims = wb_dims(3, 6), comment = c3)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":null,"dir":"Reference","previous_headings":"","what":"Copy cells around within a worksheet — wb_copy_cells","title":"Copy cells around within a worksheet — wb_copy_cells","text":"Copy cells around within worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Copy cells around within a worksheet — wb_copy_cells","text":"","code":"wb_copy_cells( wb, sheet = current_sheet(), dims = \"A1\", data, as_value = FALSE, as_ref = FALSE, transpose = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Copy cells around within a worksheet — wb_copy_cells","text":"wb workbook sheet worksheet dims cell place copy data wb_data object containing cells copy as_value copy value written? as_ref references cell written? transpose data written transposed? ... additional arguments passed add_data() used as_value","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Copy cells around within a worksheet — wb_copy_cells","text":"wbWorkbook invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_copy_cells.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Copy cells around within a worksheet — wb_copy_cells","text":"","code":"wb <- wb_workbook()$ add_worksheet()$ add_data(x = mtcars)$ add_fill(dims = \"A1:F1\", color = wb_color(\"yellow\")) dat <- wb_data(wb, dims = \"A1:D4\", col_names = FALSE) # 1:1 copy to M2 wb$ clone_worksheet(old = 1, new = \"Clone1\")$ copy_cells(data = dat, dims = \"M2\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Add the wb_data attribute to a data frame in a worksheet — wb_data","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"provide wb_data object mschart input","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"","code":"wb_data(wb, sheet = current_sheet(), dims, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"wb workbook sheet sheet workbook either name index dims dimensions ... additional arguments wb_to_df(). aware every argument valid.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"data frame class wb_data.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add the wb_data attribute to a data frame in a worksheet — wb_data","text":"","code":"wb <- wb_workbook() %>% wb_add_worksheet() %>% wb_add_data(x = mtcars, dims = \"B2\") wb_data(wb, 1, dims = \"B2:E6\") #> mpg cyl disp hp #> 3 21.0 6 160 110 #> 4 21.0 6 160 110 #> 5 22.8 4 108 93 #> 6 21.4 6 258 110"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper to specify the dims argument — wb_dims","title":"Helper to specify the dims argument — wb_dims","text":"wb_dims() can used help provide dims argument, wb_add_* functions. returns A1 spreadsheet range (\"A1:B1\" \"A2\"). can useful can specify many parameters interact together general, must provide named arguments. wb_dims() accept unnamed arguments rows, cols, example wb_dims(1:4, 1:2), return \"A1:B4\". wb_dims() can also used object (data.frame matrix example.) parameters numeric unless stated otherwise.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper to specify the dims argument — wb_dims","text":"","code":"wb_dims(..., select = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper to specify the dims argument — wb_dims","text":"... construct dims arguments, rows/cols vectors objects can coerced data frame. x, rows, cols, from_row, from_col, row_names, col_names accepted. select string, one followings. improves selection various parts x One \"x\", \"data\", \"col_names\", \"row_names\". \"data\" select data part, excluding row names column names (default cols rows specified) \"x\" Includes data, column row names present. (default none rows cols provided) \"col_names\" return column names \"row_names\" return row names.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper to specify the dims argument — wb_dims","text":"dims string","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Helper to specify the dims argument — wb_dims","text":"using wb_dims() object, default behavior select data / row columns x need another behavior, use wb_dims() without supplying x. x object (typically matrix data.frame, vector also accepted.) from_row / from_col starting position x (dims returned assume top left corner x from_row / from_col rows Optional row span x apply . rows = 0, column names affected. cols range columns id x, one column names x (length 1 accepted column names x.) row_names logical, let wb_dims() know x row names . row_names = TRUE, wb_dims() increment from_col 1. col_names wb_dims() assumes x column names, trying find dims. wb_dims() tries support possible cases row_names = TRUE col_names = FALSE, works best x named dimensions (data.frame, matrix), parameters specified. data column names, without row names. code clean. add_data() / add_font() example, writing data row names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"using-wb-dims-without-an-x-object","dir":"Reference","previous_headings":"","what":"Using wb_dims() without an x object","title":"Helper to specify the dims argument — wb_dims","text":"rows / cols (want specify single one, use from_row / from_col) from_row / from_col starting position dims (similar start_row / start_col, clearer name.)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"using-wb-dims-with-an-x-object","dir":"Reference","previous_headings":"","what":"Using wb_dims() with an x object","title":"Helper to specify the dims argument — wb_dims","text":"wb_dims() object 8 use-cases (work position values from_row / from_col), from_col/from_row correspond coordinates top left x including column row names present. use cases provided without from_row / from_col, work also from_row / from_col. provide full grid wb_dims(x = mtcars) provide data grid wb_dims(x = mtcars, select = \"data\") provide dims column names wb_dims(x = mtcars, select = \"col_names) provide dims row names wb_dims(x = mtcars, row_names = TRUE, select = \"row_names\") provide dims row span wb_dims(x = mtcars, rows = 1:10) selects first 10 data rows mtcars (ignoring column names) provide dims data column span wb_dims(x = mtcars, cols = 1:5) select data first 5 columns mtcars provide column span (including column names) wb_dims(x = mtcars, cols = 4:7, select = \"x\") select data columns 4, 5, 6, 7 mtcars + column names provide position single column name wb_dims(x = mtcars, cols = \"mpg\"). provide row span column. wb_dims(x = mtcars, cols = \"mpg\", rows = 5:22) reuse, good trick create wrapper function, styling can performed seamlessly. can useful apply many rounds styling sequentially.","code":"wb_dims_cars <- function(...) { wb_dims(x = mtcars, from_row = 2, from_col = \"B\", ...) } # using this function wb_dims_cars() # full grid (data + column names) wb_dims_cars(select = \"data\") # data only wb_dims_cars(select = \"col_names\") # select column names wb_dims_cars(cols = \"vs\") # select the `vs` column"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_dims.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper to specify the dims argument — wb_dims","text":"","code":"# Provide coordinates wb_dims(1, 4) #> [1] \"D1\" wb_dims(rows = 1, cols = 4) #> [1] \"D1\" wb_dims(from_row = 4) #> [1] \"A4\" wb_dims(from_col = 2) #> [1] \"B1\" wb_dims(from_col = \"B\") #> [1] \"B1\" wb_dims(1:4, 6:9, from_row = 5) #> [1] \"F5:I8\" # Provide vectors wb_dims(1:10, c(\"A\", \"B\", \"C\")) #> [1] \"A1:C10\" wb_dims(rows = 1:10, cols = 1:10) #> [1] \"A1:J10\" # provide `from_col` / `from_row` wb_dims(rows = 1:10, cols = c(\"A\", \"B\", \"C\"), from_row = 2) #> [1] \"A2:C11\" wb_dims(rows = 1:10, cols = 1:10, from_col = 2) #> [1] \"B1:K10\" # or objects wb_dims(x = mtcars, col_names = TRUE) #> [1] \"A1:K33\" # select all data wb_dims(x = mtcars, select = \"data\") #> [1] \"A2:K33\" # column names of an object (with the special select = \"col_names\") wb_dims(x = mtcars, select = \"col_names\") #> [1] \"A1:K1\" # dims of the column names of an object wb_dims(x = mtcars, select = \"col_names\", col_names = TRUE) #> [1] \"A1:K1\" ## add formatting to `mtcars` using `wb_dims()`---- wb <- wb_workbook() wb$add_worksheet(\"test wb_dims() with an object\") dims_mtcars_and_col_names <- wb_dims(x = mtcars) wb$add_data(x = mtcars, dims = dims_mtcars_and_col_names) # Put the font as Arial for the data dims_mtcars_data <- wb_dims(x = mtcars, select = \"data\") wb$add_font(dims = dims_mtcars_data, name = \"Arial\") # Style col names as bold using the special `select = \"col_names\"` with `x` provided. dims_column_names <- wb_dims(x = mtcars, select = \"col_names\") wb$add_font(dims = dims_column_names, bold = TRUE, size = 13) # Finally, to add styling to column \"cyl\" (the 4th column) (only the data) # there are many options, but here is the preferred one # if you know the column index, wb_dims(x = mtcars, cols = 4) also works. dims_cyl <- wb_dims(x = mtcars, cols = \"cyl\") wb$add_fill(dims = dims_cyl, color = wb_color(\"pink\")) # Mark a full column as important(with the column name too) wb_dims_vs <- wb_dims(x = mtcars, cols = \"vs\", select = \"x\") wb$add_fill(dims = wb_dims_vs, fill = wb_color(\"yellow\")) wb$add_conditional_formatting(dims = wb_dims(x = mtcars, cols = \"mpg\"), type = \"dataBar\") # wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":null,"dir":"Reference","previous_headings":"","what":"Freeze pane of a worksheet — wb_freeze_pane","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"Add Freeze pane worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"","code":"wb_freeze_pane( wb, sheet = current_sheet(), first_active_row = NULL, first_active_col = NULL, first_row = FALSE, first_col = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"wb workbook object sheet name index worksheet first_active_row Top row active region first_active_col Furthest left column active region first_row TRUE, freezes first row (equivalent first_active_row = 2) first_col TRUE, freezes first column (equivalent first_active_col = 2) ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_freeze_pane.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Freeze pane of a worksheet — wb_freeze_pane","text":"","code":"## Create a new workbook wb <- wb_workbook(\"Kenshin\") ## Add some worksheets wb$add_worksheet(\"Sheet 1\") wb$add_worksheet(\"Sheet 2\") wb$add_worksheet(\"Sheet 3\") wb$add_worksheet(\"Sheet 4\") ## Freeze Panes wb$freeze_pane(\"Sheet 1\", first_active_row = 5, first_active_col = 3) wb$freeze_pane(\"Sheet 2\", first_col = TRUE) ## shortcut to first_active_col = 2 wb$freeze_pane(3, first_row = TRUE) ## shortcut to first_active_row = 2 wb$freeze_pane(4, first_active_row = 1, first_active_col = \"D\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"List Excel tables in a worksheet — wb_get_tables","title":"List Excel tables in a worksheet — wb_get_tables","text":"List Excel tables worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List Excel tables in a worksheet — wb_get_tables","text":"","code":"wb_get_tables(wb, sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List Excel tables in a worksheet — wb_get_tables","text":"wb workbook object sheet name index worksheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List Excel tables in a worksheet — wb_get_tables","text":"character vector table names specified sheet","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_get_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List Excel tables in a worksheet — wb_get_tables","text":"","code":"wb <- wb_workbook() wb$add_worksheet(sheet = \"Sheet 1\") wb$add_data_table(x = iris) wb$add_data_table(x = mtcars, table_name = \"mtcars\", start_col = 10) wb$get_tables(sheet = \"Sheet 1\") #> tab_name tab_ref #> 1 Table1 A1:E151 #> 2 mtcars J1:T33"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":null,"dir":"Reference","previous_headings":"","what":"Load an existing .xlsx file — wb_load","title":"Load an existing .xlsx file — wb_load","text":"wb_load() returns wbWorkbook object conserving styles formatting original input file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load an existing .xlsx file — wb_load","text":"","code":"wb_load(file, sheet, data_only = FALSE, calc_chain = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load an existing .xlsx file — wb_load","text":"file path existing .xlsx, .xlsm .xlsb file sheet optional sheet parameter. applied, selected sheet loaded. can numeric, string NULL. data_only mode import data frame returned. strips wbWorkbook bare minimum. calc_chain optionally can keep calculation chain intact. used spreadsheet software identify order formulas evaluated. Removing calculation chain considered harmless. calc chain created upon next time worksheet loaded spreadsheet software. Keeping , might speed loading time said software. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load an existing .xlsx file — wb_load","text":"Workbook object.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Load an existing .xlsx file — wb_load","text":"warning displayed xml namespace main found xlsx file. Certain xlsx files created third-party applications contain namespace (usually x). namespace required file work spreadsheet software expected openxlsx2. Therefore removed file loaded workbook. Removal generally expected safe, feature still experimental. Initial support binary openxml files (xlsb) added package. parse binary file format pseudo-openxml files can import. Therefore, importing, possible interact file provided xlsx first place. course slower reading directly binary file. implementation also still missing features: array formulas still broken, conditional formatting data validation implemented, pivot tables slicers. possible import wb_load(data_only = TRUE, sheet = NULL). way workbook skeleton loaded. can useful workbook properties interest.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_load.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load an existing .xlsx file — wb_load","text":"","code":"## load existing workbook from package folder wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) wb$get_sheet_names() # list worksheets #> Sheet1 Sheet2 #> \"Sheet1\" \"Sheet2\" wb ## view object #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet1, Sheet2 #> Write order: 1, 2 ## Add a worksheet wb$add_worksheet(\"A new worksheet\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":null,"dir":"Reference","previous_headings":"","what":"Merge cells within a worksheet — wb_merge_cells","title":"Merge cells within a worksheet — wb_merge_cells","text":"Worksheet cell merging","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Merge cells within a worksheet — wb_merge_cells","text":"","code":"wb_merge_cells(wb, sheet = current_sheet(), dims = NULL, solve = FALSE, ...) wb_unmerge_cells(wb, sheet = current_sheet(), dims = NULL, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Merge cells within a worksheet — wb_merge_cells","text":"wb Workbook object sheet name index worksheet dims worksheet cells solve logical intersecting merges solved ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Merge cells within a worksheet — wb_merge_cells","text":"using deprecated arguments rows cols merged region must rectangular, min max cols rows used.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_merge_cells.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Merge cells within a worksheet — wb_merge_cells","text":"","code":"# Create a new workbook wb <- wb_workbook()$add_worksheet() # Merge cells: Row 2 column C to F (3:6) wb <- wb_merge_cells(wb, dims = \"C3:F6\") # Merge cells:Rows 10 to 20 columns A to J (1:10) wb <- wb_merge_cells(wb, dims = wb_dims(rows = 10:20, cols = 1:10)) wb$add_worksheet() ## Intersecting merges wb <- wb_merge_cells(wb, dims = wb_dims(cols = 1:10, rows = 1)) wb <- wb_merge_cells(wb, dims = wb_dims(cols = 5:10, rows = 2)) wb <- wb_merge_cells(wb, dims = wb_dims(cols = 1:10, rows = 12)) try(wb_merge_cells(wb, dims = \"A1:A10\")) #> Error : Merge intersects with existing merged cells: #> \t\tA1:J1. #> Remove existing merge first. ## remove merged cells # removes any intersecting merges wb <- wb_unmerge_cells(wb, dims = wb_dims(cols = 1, rows = 1)) wb <- wb_merge_cells(wb, dims = \"A1:A10\") # or let us decide how to solve this wb <- wb_merge_cells(wb, dims = \"A1:A10\", solve = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_open.html","id":null,"dir":"Reference","previous_headings":"","what":"Preview a workbook in a spreadsheet software — wb_open","title":"Preview a workbook in a spreadsheet software — wb_open","text":"can also use shorter wb$open() replacement. open xlsx files, see xl_open().","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_open.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Preview a workbook in a spreadsheet software — wb_open","text":"","code":"wb_open(wb)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_open.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Preview a workbook in a spreadsheet software — wb_open","text":"wb wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":null,"dir":"Reference","previous_headings":"","what":"Order worksheets in a workbook — wb_order","title":"Order worksheets in a workbook — wb_order","text":"Get/set order worksheets Workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Order worksheets in a workbook — wb_order","text":"","code":"wb_get_order(wb) wb_set_order(wb, sheets)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Order worksheets in a workbook — wb_order","text":"wb wbWorkbook object sheets Sheet order","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Order worksheets in a workbook — wb_order","text":"function reorder worksheets within workbook object, simply shuffles order writing file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_order.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Order worksheets in a workbook — wb_order","text":"","code":"## setup a workbook with 3 worksheets wb <- wb_workbook() wb$add_worksheet(\"Sheet 1\", gridLines = FALSE) wb$add_data_table(sheet = 1, x = iris) wb$add_worksheet(\"mtcars (Sheet 2)\", gridLines = FALSE) wb$add_data(sheet = 2, x = mtcars) wb$add_worksheet(\"Sheet 3\", gridLines = FALSE) wb$add_data(sheet = 3, x = Formaldehyde) wb_get_order(wb) #> [1] 1 2 3 wb$get_sheet_na #> NULL wb$set_order(c(1, 3, 2)) # switch position of sheets 2 & 3 wb$add_data(2, 'This is still the \"mtcars\" worksheet', startCol = 15) wb_get_order(wb) #> [1] 1 3 2 wb$get_sheet_names() ## ordering within workbook is not changed #> Sheet 1 Sheet 3 mtcars (Sheet 2) #> \"Sheet 1\" \"Sheet 3\" \"mtcars (Sheet 2)\" wb$set_order(3:1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":null,"dir":"Reference","previous_headings":"","what":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"Set page margins, orientation print scaling.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"","code":"wb_page_setup( wb, sheet = current_sheet(), orientation = NULL, scale = 100, left = 0.7, right = 0.7, top = 0.75, bottom = 0.75, header = 0.3, footer = 0.3, fit_to_width = FALSE, fit_to_height = FALSE, paper_size = NULL, print_title_rows = NULL, print_title_cols = NULL, summary_row = NULL, summary_col = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"wb workbook object sheet name index worksheet orientation Page orientation. One \"portrait\" \"landscape\" scale Print scaling. Numeric value 10 400 left, right, top, bottom Page margin inches header, footer Margin inches fit_to_width, fit_to_height TRUE, worksheet scaled fit page width /height printing. paper_size See details. Default value 9 (A4 paper). print_title_rows, print_title_cols Rows / columns repeat top page printing. Integer vector. summary_row Location summary rows groupings. One \"\" \"\". summary_col Location summary columns groupings. One \"Right\" \"Left\". ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"paper_size integer corresponding :","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_page_setup.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set page margins, orientation and print scaling of a worksheet — wb_page_setup","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"S1\") wb$add_worksheet(\"S2\") wb$add_data_table(1, x = iris[1:30, ]) wb$add_data_table(2, x = iris[1:30, ], dims = c(\"C5\")) ## landscape page scaled to 50% wb$page_setup(sheet = 1, orientation = \"landscape\", scale = 50) ## portrait page scales to 300% with 0.5in left and right margins wb$page_setup(sheet = 2, orientation = \"portrait\", scale = 300, left = 0.5, right = 0.5) ## print titles wb$add_worksheet(\"print_title_rows\") wb$add_worksheet(\"print_title_cols\") wb$add_data(\"print_title_rows\", rbind(iris, iris, iris, iris)) wb$add_data(\"print_title_cols\", x = rbind(mtcars, mtcars, mtcars), rowNames = TRUE) wb$page_setup(sheet = \"print_title_rows\", printTitleRows = 1) ## first row wb$page_setup(sheet = \"print_title_cols\", printTitleCols = 1, printTitleRows = 1)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":null,"dir":"Reference","previous_headings":"","what":"Protect a workbook from modifications — wb_protect","title":"Protect a workbook from modifications — wb_protect","text":"Protect unprotect workbook modifications user graphical user interface. Replaces existing protection.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Protect a workbook from modifications — wb_protect","text":"","code":"wb_protect( wb, protect = TRUE, password = NULL, lock_structure = FALSE, lock_windows = FALSE, type = 1, file_sharing = FALSE, username = unname(Sys.info()[\"user\"]), read_only_recommended = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Protect a workbook from modifications — wb_protect","text":"wb Workbook object protect Whether protect unprotect sheet (default TRUE) password (optional) password required unprotect workbook lock_structure Whether workbook structure locked lock_windows Whether window position spreadsheet locked type Lock type (see Details) file_sharing Whether enable popup requesting unlock password prompted username username file_sharing popup read_only_recommended Whether post unlock message appears stating workbook recommended opened read-mode. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Protect a workbook from modifications — wb_protect","text":"Lock types: 1 xlsx password (default) 2 xlsx recommends read-4 xlsx enforces read-8 xlsx locked annotation","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Protect a workbook from modifications — wb_protect","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"S1\") wb_protect(wb, protect = TRUE, password = \"Password\", lock_structure = TRUE) # Remove the protection wb_protect(wb, protect = FALSE) #> A Workbook object. #> #> Worksheets: #> Sheets: S1 #> Write order: 1 wb <- wb_protect( wb, protect = TRUE, password = \"Password\", lock_structure = TRUE, type = 2L, file_sharing = TRUE, username = \"Test\", read_only_recommended = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Protect a worksheet from modifications — wb_protect_worksheet","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"Protect unprotect worksheet modifications user graphical user interface. Replaces existing protection.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"","code":"wb_protect_worksheet( wb, sheet = current_sheet(), protect = TRUE, password = NULL, properties = NULL )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"wb workbook object sheet name index worksheet protect Whether protect unprotect sheet (default=TRUE) password (optional) password required unprotect worksheet properties character vector properties lock. Can one following: \"selectLockedCells\", \"selectUnlockedCells\", \"formatCells\", \"formatColumns\", \"formatRows\", \"insertColumns\", \"insertRows\", \"insertHyperlinks\", \"deleteColumns\", \"deleteRows\", \"sort\", \"autoFilter\", \"pivotTables\", \"objects\", \"scenarios\"","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_protect_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Protect a worksheet from modifications — wb_protect_worksheet","text":"","code":"wb <- wb_workbook() wb$add_worksheet(\"S1\") wb$add_data_table(1, x = iris[1:30, ]) wb$protect_worksheet( \"S1\", protect = TRUE, properties = c(\"formatCells\", \"formatColumns\", \"insertColumns\", \"deleteColumns\") ) # Formatting cells / columns is allowed , but inserting / deleting columns is protected: wb$protect_worksheet( \"S1\", protect = TRUE, c(formatCells = FALSE, formatColumns = FALSE, insertColumns = TRUE, deleteColumns = TRUE) ) # Remove the protection wb$protect_worksheet(\"S1\", protect = FALSE) #> A Workbook object. #> #> Worksheets: #> Sheets: S1 #> Write order: 1"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a data table from a worksheet — wb_remove_tables","title":"Remove a data table from a worksheet — wb_remove_tables","text":"Remove Excel tables workbook using name.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a data table from a worksheet — wb_remove_tables","text":"","code":"wb_remove_tables(wb, sheet = current_sheet(), table, remove_data = TRUE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a data table from a worksheet — wb_remove_tables","text":"wb Workbook object sheet name index worksheet table Name table remove. Use wb_get_tables() view tables present worksheet. remove_data Default TRUE. FALSE, remove data table attributes keep data worksheet.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a data table from a worksheet — wb_remove_tables","text":"wbWorkbook, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove a data table from a worksheet — wb_remove_tables","text":"","code":"wb <- wb_workbook() wb$add_worksheet(sheet = \"Sheet 1\") wb$add_worksheet(sheet = \"Sheet 2\") wb$add_data_table(sheet = \"Sheet 1\", x = iris, table_name = \"iris\") wb$add_data_table(sheet = 1, x = mtcars, table_name = \"mtcars\", start_col = 10) ## delete worksheet removes table objects wb <- wb_remove_worksheet(wb, sheet = 1) wb$add_data_table(sheet = 1, x = iris, table_name = \"iris\") wb$add_data_table(sheet = 1, x = mtcars, table_name = \"mtcars\", start_col = 10) ## wb_remove_tables() deletes table object and all data wb_get_tables(wb, sheet = 1) #> tab_name tab_ref #> 3 iris A1:E151 #> 4 mtcars J1:T33 wb$remove_tables(sheet = 1, table = \"iris\") wb$add_data_table(sheet = 1, x = iris, table_name = \"iris\") wb_get_tables(wb, sheet = 1) #> tab_name tab_ref #> 4 mtcars J1:T33 #> 5 iris A1:E151 wb$remove_tables(sheet = 1, table = \"iris\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a worksheet from a workbook — wb_remove_worksheet","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"Remove worksheet workbook","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"","code":"wb_remove_worksheet(wb, sheet = current_sheet())"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"wb wbWorkbook object sheet sheet name index remove","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"wbWorkbook object, invisibly.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_remove_worksheet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove a worksheet from a workbook — wb_remove_worksheet","text":"","code":"## load a workbook wb <- wb_load(file = system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\")) ## Remove sheet 2 wb <- wb_remove_worksheet(wb, 2)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":null,"dir":"Reference","previous_headings":"","what":"Save a workbook to file — wb_save","title":"Save a workbook to file — wb_save","text":"Save workbook file","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save a workbook to file — wb_save","text":"","code":"wb_save(wb, file = NULL, overwrite = TRUE, path = NULL)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save a workbook to file — wb_save","text":"wb wbWorkbook object write file file path save workbook overwrite FALSE, overwrite file already exists. path Deprecated argument. Please use file new code.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Save a workbook to file — wb_save","text":"wbWorkbook object, invisibly","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_save.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save a workbook to file — wb_save","text":"","code":"## Create a new workbook and add a worksheet wb <- wb_workbook(\"Creator of workbook\") wb$add_worksheet(sheet = \"My first worksheet\") ## Save workbook to working directory # \\donttest{ wb_save(wb, file = temp_xlsx(), overwrite = TRUE) # }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the workbook position, size and filter — wb_set_bookview","title":"Set the workbook position, size and filter — wb_set_bookview","text":"Set workbook position, size filter","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the workbook position, size and filter — wb_set_bookview","text":"","code":"wb_set_bookview( wb, active_tab = NULL, auto_filter_date_grouping = NULL, first_sheet = NULL, minimized = NULL, show_horizontal_scroll = NULL, show_sheet_tabs = NULL, show_vertical_scroll = NULL, tab_ratio = NULL, visibility = NULL, window_height = NULL, window_width = NULL, x_window = NULL, y_window = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the workbook position, size and filter — wb_set_bookview","text":"wb wbWorkbook object active_tab activeTab auto_filter_date_grouping autoFilterDateGrouping first_sheet first sheet displayed minimized minimized show_horizontal_scroll showHorizontalScroll show_sheet_tabs showSheetTabs show_vertical_scroll showVerticalScroll tab_ratio tabRatio visibility visibility window_height windowHeight window_width windowWidth x_window xWindow y_window yWindow ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_bookview.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the workbook position, size and filter — wb_set_bookview","text":"Workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"Set worksheet grid lines show hide. can also add / remove grid lines creating worksheet wb_add_worksheet(grid_lines = FALSE)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"","code":"wb_set_grid_lines(wb, sheet = current_sheet(), show = FALSE, print = show) wb_grid_lines(wb, sheet = current_sheet(), show = FALSE, print = show)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"wb workbook object sheet name index worksheet show logical. FALSE, grid lines hidden. print logical. FALSE, grid lines printed.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_grid_lines.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify grid lines visibility in a worksheet — wb_set_grid_lines","text":"","code":"wb <- wb_workbook()$add_worksheet()$add_worksheet() wb$get_sheet_names() ## list worksheets in workbook #> Sheet 1 Sheet 2 #> \"Sheet 1\" \"Sheet 2\" wb$set_grid_lines(1, show = FALSE) wb$set_grid_lines(\"Sheet 2\", show = FALSE)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":null,"dir":"Reference","previous_headings":"","what":"Set headers and footers of a worksheet — wb_set_header_footer","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"Set document headers footers. can also adding worksheet wb_add_worksheet() header, footer arguments friends. show printing xlsx file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"","code":"wb_set_header_footer( wb, sheet = current_sheet(), header = NULL, footer = NULL, even_header = NULL, even_footer = NULL, first_header = NULL, first_footer = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"wb Workbook object sheet name index worksheet header, even_header, first_header, footer, even_footer, first_footer Character vector length 3 corresponding positions left, center, right. header footer used default additional arguments. Setting even, odd, first, overrides header/footer. Use NA skip position. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"Headers footers can contain special tags &[Page] Page number &[Pages] Number pages &[Date] Current date &[Time] Current time &[Path] File path &[File] File name &[Tab] Worksheet name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_header_footer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set headers and footers of a worksheet — wb_set_header_footer","text":"","code":"wb <- wb_workbook() # Add example data wb$add_worksheet(\"S1\")$add_data(x = 1:400) wb$add_worksheet(\"S2\")$add_data(x = 1:400) wb$add_worksheet(\"S3\")$add_data(x = 3:400) wb$add_worksheet(\"S4\")$add_data(x = 3:400) wb$set_header_footer( sheet = \"S1\", header = c(\"ODD HEAD LEFT\", \"ODD HEAD CENTER\", \"ODD HEAD RIGHT\"), footer = c(\"ODD FOOT RIGHT\", \"ODD FOOT CENTER\", \"ODD FOOT RIGHT\"), even_header = c(\"EVEN HEAD LEFT\", \"EVEN HEAD CENTER\", \"EVEN HEAD RIGHT\"), even_footer = c(\"EVEN FOOT RIGHT\", \"EVEN FOOT CENTER\", \"EVEN FOOT RIGHT\"), first_header = c(\"TOP\", \"OF FIRST\", \"PAGE\"), first_footer = c(\"BOTTOM\", \"OF FIRST\", \"PAGE\") ) wb$set_header_footer( sheet = 2, header = c(\"&[Date]\", \"ALL HEAD CENTER 2\", \"&[Page] / &[Pages]\"), footer = c(\"&[Path]&[File]\", NA, \"&[Tab]\"), first_header = c(NA, \"Center Header of First Page\", NA), first_footer = c(NA, \"Center Footer of First Page\", NA) ) wb$set_header_footer( sheet = 3, header = c(\"ALL HEAD LEFT 2\", \"ALL HEAD CENTER 2\", \"ALL HEAD RIGHT 2\"), footer = c(\"ALL FOOT RIGHT 2\", \"ALL FOOT CENTER 2\", \"ALL FOOT RIGHT 2\") ) wb$set_header_footer( sheet = 4, first_header = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\"), first_footer = c(\"FIRST ONLY L\", NA, \"FIRST ONLY R\") )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify author in the metadata of a workbook — wb_set_last_modified_by","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"Just wrapper wb$set_last_modified_by()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"","code":"wb_set_last_modified_by(wb, name, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"wb workbook object name string object name LastModifiedBy-User ... additional arguments","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_last_modified_by.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify author in the metadata of a workbook — wb_set_last_modified_by","text":"","code":"wb <- wb_workbook() wb_set_last_modified_by(wb, \"test\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify the default view of a worksheet — wb_set_sheetview","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"helps set worksheet's appearance, zoom, whether show grid lines","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"","code":"wb_set_sheetview( wb, sheet = current_sheet(), color_id = NULL, default_grid_color = NULL, right_to_left = NULL, show_formulas = NULL, show_grid_lines = NULL, show_outline_symbols = NULL, show_row_col_headers = NULL, show_ruler = NULL, show_white_space = NULL, show_zeros = NULL, tab_selected = NULL, top_left_cell = NULL, view = NULL, window_protection = NULL, workbook_view_id = NULL, zoom_scale = NULL, zoom_scale_normal = NULL, zoom_scale_page_layout_view = NULL, zoom_scale_sheet_layout_view = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"wb Workbook object sheet sheet color_id, default_grid_color Integer: color, default 64 right_to_left Logical: TRUE column ordering right left show_formulas Logical: TRUE cell formulas shown show_grid_lines Logical: TRUE worksheet grid shown show_outline_symbols Logical: TRUE outline symbols shown show_row_col_headers Logical: TRUE row column headers shown show_ruler Logical: TRUE ruler shown page layout view show_white_space Logical: TRUE margins shown page layout view show_zeros Logical: FALSE cells containing zero shown blank show_formulas = FALSE tab_selected Integer: zero vector indicating selected tab top_left_cell Cell: cell shown top left corner / top right rightToLeft view View: \"normal\", \"pageBreakPreview\" \"pageLayout\" window_protection Logical: TRUE panes protected workbook_view_id integer: Pointing view inside workbook zoom_scale, zoom_scale_normal, zoom_scale_page_layout_view, zoom_scale_sheet_layout_view Integer: zoom scale 10 400. values current, normal etc. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"wbWorkbook object, invisibly","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_set_sheetview.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify the default view of a worksheet — wb_set_sheetview","text":"","code":"wb <- wb_workbook()$add_worksheet() wb$set_sheetview( zoom_scale = 75, right_to_left = FALSE, show_formulas = TRUE, show_grid_lines = TRUE, show_outline_symbols = FALSE, show_row_col_headers = TRUE, show_ruler = TRUE, show_white_space = FALSE, tab_selected = 1, top_left_cell = \"B1\", view = \"normal\", window_protection = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a data frame from a Workbook — wb_to_df","title":"Create a data frame from a Workbook — wb_to_df","text":"Simple function create data.frame workbook. Simple simply written . read_xlsx() wb_read() just internal wrappers wb_to_df() intended people coming packages.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a data frame from a Workbook — wb_to_df","text":"","code":"wb_to_df( file, sheet, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, skip_hidden_rows = FALSE, skip_hidden_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, na.strings = \"#N/A\", na.numbers = NA, fill_merged_cells = FALSE, dims, show_formula = FALSE, convert = TRUE, types, named_region, keep_attributes = FALSE, ... ) read_xlsx( file, sheet, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, named_region, na.strings = \"#N/A\", na.numbers = NA, fill_merged_cells = FALSE, ... ) wb_read( file, sheet = 1, start_row = 1, start_col = NULL, row_names = FALSE, col_names = TRUE, skip_empty_rows = FALSE, skip_empty_cols = FALSE, rows = NULL, cols = NULL, detect_dates = TRUE, named_region, na.strings = \"NA\", na.numbers = NA, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a data frame from a Workbook — wb_to_df","text":"file xlsx file, wbWorkbook object URL xlsx file. sheet Either sheet name index. missing first sheet workbook selected. start_row first row begin looking data. start_col first column begin looking data. row_names TRUE, first col data used row names. col_names TRUE, first row data used column names. skip_empty_rows TRUE, empty rows skipped. skip_empty_cols TRUE, empty columns skipped. skip_hidden_rows TRUE, hidden rows skipped. skip_hidden_cols TRUE, hidden columns skipped. rows numeric vector specifying rows xlsx file read. NULL, rows read. cols numeric vector specifying columns xlsx file read. NULL, columns read. detect_dates TRUE, attempt recognize dates perform conversion. na.strings character vector strings interpreted NA. Blank cells returned NA. na.numbers numeric vector digits interpreted NA. Blank cells returned NA. fill_merged_cells TRUE, value merged cell given cells within merge. dims Character string type \"A1:B2\" optional dimensions imported. show_formula TRUE, underlying Excel formulas shown. convert TRUE, conversion dates numerics attempted. types named numeric indicating, type data. Names must match returned data. See Details . named_region Character string named_region (defined name table). sheet selected, first appearance selected. See wb_get_named_regions() keep_attributes TRUE additional attributes returned. (used internally define cell type.) ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a data frame from a Workbook — wb_to_df","text":"Depending R package hms loaded, wb_to_df() returns hms variables string variables hh:mm:ss format. types argument must named numeric. 0: character 1: numeric 2: date 3: posixt (datetime) 4: logical read_xlsx() pick formulas added Workbook object via wb_add_formula(). formula written left evaluated file opened spreadsheet software. Opening, saving closing file spreadsheet software resolve .","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_to_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a data frame from a Workbook — wb_to_df","text":"","code":"########################################################################### # numerics, dates, missings, bool and string example_file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") wb1 <- wb_load(example_file) # import workbook wb_to_df(wb1) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # do not convert first row to column names wb_to_df(wb1, col_names = FALSE) #> B C D E F G H I J #> 2 NA Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # do not try to identify dates in the data wb_to_df(wb1, detect_dates = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 45075 3209324 This #DIV/0! 0.06059028 #> 4 TRUE NA NA #NUM! b 45069 0 0.58538194 #> 5 TRUE 2 NA 1.34 c 44958 #VALUE! 0.95905093 #> 6 FALSE 2 NA #NUM! NA 2 0.72561343 #> 7 FALSE 3 NA 1.56 e NA NA #> 8 FALSE 1 NA 1.7 f 44987 2.7 0.36525463 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23 h 45284 25 NA #> 11 FALSE 3 NA 67.3 i 45285 3 NA #> 12 NA 1 NA 123 45138 122 NA # return the underlying Excel formula instead of their values wb_to_df(wb1, show_formula = TRUE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This E3/0 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 C4 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! C6+E6 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 C8+E8 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 SUM(C10,E10) #> 11 FALSE 3 NA 67.3 i 2023-12-25 PRODUCT(C11,E3) #> 12 NA 1 NA 123 2023-07-31 E12-C12 # read dimension without colNames wb_to_df(wb1, dims = \"A2:C5\", col_names = FALSE) #> A B C #> 2 NA NA Var2 #> 3 NA TRUE 1 #> 4 NA TRUE #> 5 NA TRUE 2 # read selected cols wb_to_df(wb1, cols = c(\"A:B\", \"G\")) #> NA Var1 Var5 #> 3 NA TRUE 2023-05-29 #> 4 NA TRUE 2023-05-23 #> 5 NA TRUE 2023-02-01 #> 6 NA FALSE #> 7 NA FALSE #> 8 NA FALSE 2023-03-02 #> 9 NA NA #> 10 NA FALSE 2023-12-24 #> 11 NA FALSE 2023-12-25 #> 12 NA NA 2023-07-31 # read selected rows wb_to_df(wb1, rows = c(2, 4, 6)) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 4 TRUE NA NA #NUM! b 2023-05-23 NA 0 14:02:57 #> 6 FALSE 2 NA #NUM! NA 2 17:24:53 # convert characters to numerics and date (logical too?) wb_to_df(wb1, convert = FALSE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 1 123 2023-07-31 122 # erase empty rows from dataset wb_to_df(wb1, skip_empty_rows = TRUE) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 # erase empty columns from dataset wb_to_df(wb1, skip_empty_cols = TRUE) #> Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 #NUM! 2 17:24:53 #> 7 FALSE 3 1.56 e #> 8 FALSE 1 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA #> 10 FALSE 2 23 h 2023-12-24 25 #> 11 FALSE 3 67.3 i 2023-12-25 3 #> 12 NA 1 123 2023-07-31 122 # convert first row to rownames wb_to_df(wb1, sheet = 2, dims = \"C6:G9\", row_names = TRUE) #> mpg cyl disp hp #> Mazda RX4 21.0 6 160 110 #> Mazda RX4 Wag 21.0 6 160 110 #> Datsun 710 22.8 4 108 93 # define type of the data.frame wb_to_df(wb1, cols = c(2, 5), types = c(\"Var1\" = 0, \"Var3\" = 1)) #> Var1 Var3 #> 3 TRUE 1.00 #> 4 TRUE NaN #> 5 TRUE 1.34 #> 6 FALSE NA #> 7 FALSE 1.56 #> 8 FALSE 1.70 #> 9 NA #> 10 FALSE 23.00 #> 11 FALSE 67.30 #> 12 123.00 # start in row 5 wb_to_df(wb1, start_row = 5, col_names = FALSE) #> B C D E F G H I J #> 5 TRUE 2 NA 1.34 c 2023-02-01 NA #VALUE! 23:01:02 #> 6 FALSE 2 NA NA #NUM! NA 2 17:24:53 #> 7 FALSE 3 NA 1.56 e NA #> 8 FALSE 1 NA 1.70 f 2023-03-02 NA 2.7 08:45:58 #> 9 NA NA NA NA NA #> 10 FALSE 2 NA 23.00 h 2023-12-24 NA 25 #> 11 FALSE 3 NA 67.30 i 2023-12-25 NA 3 #> 12 NA 1 NA 123.00 2023-07-31 NA 122 # na string wb_to_df(wb1, na.strings = \"a\") #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 ########################################################################### # Named regions file_named_region <- system.file(\"extdata\", \"namedRegions3.xlsx\", package = \"openxlsx2\") wb2 <- wb_load(file_named_region) # read dataset with named_region (returns global first) wb_to_df(wb2, named_region = \"MyRange\", col_names = FALSE) #> A B #> 1 S2A1 S2B1 # read named_region from sheet wb_to_df(wb2, named_region = \"MyRange\", sheet = 4, col_names = FALSE) #> A B #> 1 S3A1 S3B1 # read_xlsx() and wb_read() example_file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") read_xlsx(file = example_file) #> Var1 Var2 NA Var3 Var4 Var5 Var6 Var7 Var8 #> 3 TRUE 1 NA 1 a 2023-05-29 3209324 This #DIV/0! 01:27:15 #> 4 TRUE NA NA #NUM! b 2023-05-23 0 14:02:57 #> 5 TRUE 2 NA 1.34 c 2023-02-01 #VALUE! 23:01:02 #> 6 FALSE 2 NA #NUM! 2 17:24:53 #> 7 FALSE 3 NA 1.56 e #> 8 FALSE 1 NA 1.7 f 2023-03-02 2.7 08:45:58 #> 9 NA NA NA #> 10 FALSE 2 NA 23 h 2023-12-24 25 #> 11 FALSE 3 NA 67.3 i 2023-12-25 3 #> 12 NA 1 NA 123 2023-07-31 122 df1 <- wb_read(file = example_file, sheet = 1) df2 <- wb_read(file = example_file, sheet = 1, rows = c(1, 3, 5), cols = 1:3)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Update a data table position in a worksheet — wb_update_table","title":"Update a data table position in a worksheet — wb_update_table","text":"Update position data table, possibly written using wb_add_data_table()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update a data table position in a worksheet — wb_update_table","text":"","code":"wb_update_table(wb, sheet = current_sheet(), dims = \"A1\", tabname)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update a data table position in a worksheet — wb_update_table","text":"wb workbook sheet worksheet dims Cell range used new data table. tabname table name","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Update a data table position in a worksheet — wb_update_table","text":"aware function alter filter. Excluding adding rows make rows appear hide .","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_update_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Update a data table position in a worksheet — wb_update_table","text":"","code":"wb <- wb_workbook()$add_worksheet()$add_data_table(x = mtcars) wb$update_table(tabname = \"Table1\", dims = \"A1:J4\")"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new Workbook object — wb_workbook","title":"Create a new Workbook object — wb_workbook","text":"Initialize wbWorkbook object. can set workbook properties well.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new Workbook object — wb_workbook","text":"","code":"wb_workbook( creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new Workbook object — wb_workbook","text":"creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords, comments, manager, company Workbook property, string. datetime_created time workbook created theme Optional theme identified string number. See Details options. ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a new Workbook object — wb_workbook","text":"wbWorkbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a new Workbook object — wb_workbook","text":"theme can one \"Atlas\", \"Badge\", \"Berlin\", \"Celestial\", \"Crop\", \"Depth\", \"Droplet\", \"Facet\", \"Feathered\", \"Gallery\", \"Headlines\", \"Integral\", \"Ion\", \"Ion Boardroom\", \"Madison\", \"Main Event\", \"Mesh\", \"Office Theme\", \"Old Office Theme\", \"Organic\", \"Parallax\", \"Parcel\", \"Retrospect\", \"Savon\", \"Slice\", \"Vapor Trail\", \"View\", \"Wisp\", \"Wood Type\"","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/wb_workbook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a new Workbook object — wb_workbook","text":"","code":"## Create a new workbook wb <- wb_workbook() ## Set Workbook properties wb <- wb_workbook( creator = \"Me\", title = \"Expense Report\", subject = \"Expense Report - 2022 Q1\", category = \"sales\" )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an object to a worksheet — write_data","title":"Write an object to a worksheet — write_data","text":"Use wb_add_data() write_xlsx() new code.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an object to a worksheet — write_data","text":"","code":"write_data( wb, sheet, x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, col_names = TRUE, row_names = FALSE, with_filter = FALSE, sep = \", \", name = NULL, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an object to a worksheet — write_data","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x Object written. classes supported look examples. dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . array bool function written type array col_names TRUE, column names x written. row_names TRUE, row names x written. with_filter TRUE, add filters column name row. NOTE: can one filter per worksheet. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). name name named region specified. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write an object to a worksheet — write_data","text":"invisible(0)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a worksheet as an Excel table — write_datatable","title":"Write to a worksheet as an Excel table — write_datatable","text":"Write worksheet format Excel table. Use wb_add_data_table() new code. function may exported","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a worksheet as an Excel table — write_datatable","text":"","code":"write_datatable( wb, sheet, x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, col_names = TRUE, row_names = FALSE, table_style = \"TableStyleLight9\", table_name = NULL, with_filter = TRUE, sep = \", \", first_column = FALSE, last_column = FALSE, banded_rows = TRUE, banded_cols = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, na.strings = na_strings(), inline_strings = TRUE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a worksheet as an Excel table — write_datatable","text":"wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. x data frame dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write x . start_row vector specifying starting row write x . col_names TRUE, column names x written. row_names TRUE, row names x written. table_style table style name \"none\" (see vignette(\"openxlsx2_style_manual\")) table_name Name table workbook. table name must unique. with_filter TRUE, columns filters first row. sep applies list columns. separator used collapse list columns character vector e.g. sapply(x$list_column, paste, collapse = sep). options correspond Excel table options: first_column logical. TRUE, first column bold. last_column logical. TRUE, last column bold. banded_rows logical. TRUE, rows color banded. banded_cols logical. TRUE, columns color banded. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. inline_strings write characters inline strings ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_datatable.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Write to a worksheet as an Excel table — write_datatable","text":"columns x class Date/POSIXt, currency, accounting, hyperlink, percentage automatically styled dates, currency, accounting, hyperlinks, percentages respectively. string \"_openxlsx_NA\" reserved openxlsx2. x contains string, output broken.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_formula.html","id":null,"dir":"Reference","previous_headings":"","what":"Write a character vector as an Excel Formula — write_formula","title":"Write a character vector as an Excel Formula — write_formula","text":"Write character vector containing Excel formula worksheet. Use wb_add_formula() add_formula() new code. function meant internal use.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_formula.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write a character vector as an Excel Formula — write_formula","text":"","code":"write_formula( wb, sheet, x, dims = wb_dims(start_row, start_col), start_col = 1, start_row = 1, array = FALSE, cm = FALSE, apply_cell_style = TRUE, remove_cell_style = FALSE, ... )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_formula.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write a character vector as an Excel Formula — write_formula","text":"wb Workbook object containing worksheet. sheet worksheet write . (either index name) x formula character vector. dims Spreadsheet dimensions determine x spans: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column write . start_row vector specifying starting row write . array bool function written type array cm special kind array function hides curly braces cell. Add , see \"@\" inserted formulas. apply_cell_style write cell styles workbook? remove_cell_style keep cell style? ... additional arguments","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":null,"dir":"Reference","previous_headings":"","what":"Write data to an xlsx file — write_xlsx","title":"Write data to an xlsx file — write_xlsx","text":"Write data frame list data frames xlsx file.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write data to an xlsx file — write_xlsx","text":"","code":"write_xlsx(x, file, as_table = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write data to an xlsx file — write_xlsx","text":"x object list objects can handled wb_add_data() write file file xlsx file name as_table TRUE, write data table, instead data. ... Arguments passed wb_workbook, wb_add_worksheet, wb_add_data_table, wb_add_data, wb_freeze_pane, wb_set_col_widths, wb_save creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. sheet name new worksheet grid_lines logical. FALSE, worksheet grid lines hidden. tab_color Color sheet tab. wb_color(), valid color (belonging grDevices::colors()) valid hex color beginning \"#\". zoom sheet zoom level, numeric 10 400 percentage. (zoom value smaller 10 default 10.) start_col vector specifying starting column write x . start_row vector specifying starting row write x . col_names TRUE, column names x written. row_names TRUE, row names x written. na.strings Value used replacing NA values x. Default na_strings() uses special #N/value within workbook. first_active_row Top row active region first_active_col Furthest left column active region first_row TRUE, freezes first row (equivalent first_active_row = 2) first_col TRUE, freezes first column (equivalent first_active_col = 2) widths Width set cols specified column width \"auto\" automatic sizing. widths recycled length cols. openxlsx2 sets default width 8.43, standard spreadsheet software. See Details general information column widths. overwrite FALSE, overwrite file already exists.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write data to an xlsx file — write_xlsx","text":"workbook object","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Write data to an xlsx file — write_xlsx","text":"columns x class Date POSIXt automatically styled dates datetimes respectively.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/write_xlsx.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write data to an xlsx file — write_xlsx","text":"","code":"## write to working directory write_xlsx(iris, file = temp_xlsx(), col_names = TRUE) write_xlsx(iris, file = temp_xlsx(), col_names = TRUE ) ## Lists elements are written to individual worksheets, using list names as sheet names if available l <- list(\"IRIS\" = iris, \"MTCARS\" = mtcars, matrix(runif(1000), ncol = 5)) write_xlsx(l, temp_xlsx(), col_widths = c(NA, \"auto\", \"auto\")) ## different sheets can be given different parameters write_xlsx(l, temp_xlsx(), start_col = c(1, 2, 3), start_row = 2, as_table = c(TRUE, TRUE, FALSE), with_filter = c(TRUE, FALSE, FALSE) ) # specify column widths for multiple sheets write_xlsx(l, temp_xlsx(), col_widths = 20) write_xlsx(l, temp_xlsx(), col_widths = list(100, 200, 300)) write_xlsx(l, temp_xlsx(), col_widths = list(rep(10, 5), rep(8, 11), rep(5, 5)))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":null,"dir":"Reference","previous_headings":"","what":"Open an xlsx file or a wbWorkbook object — xl_open","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"function tries open Microsoft Excel (xls/xlsx) file , wbWorkbook proper application, portable manner. Windows uses base::shell.exec() (Windows function) determine appropriate program. Mac, (c) uses system default handlers, given file type. Linux, searches (via ) available xls/xlsx reader applications (unless options('openxlsx2.excelApp') set app bin path), finds anything, sets options('openxlsx2.excelApp') program chosen user via menu (many present, otherwise set available). Currently searched apps Libreoffice/Openoffice (soffice bin), Gnumeric (gnumeric) Calligra Sheets (calligrasheets).","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"","code":"xl_open(x, interactive = NA) # S3 method for wbWorkbook xl_open(x, interactive = NA) # S3 method for default xl_open(x, interactive = NA)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"x path Excel (xls/xlsx) file wbWorkbook object. interactive FALSE throw warning open path. can manually set TRUE, otherwise NA (default) uses value returned base::interactive()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xl_open.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Open an xlsx file or a wbWorkbook object — xl_open","text":"","code":"# \\donttest{ if (interactive()) { xlsx_file <- system.file(\"extdata\", \"openxlsx2_example.xlsx\", package = \"openxlsx2\") xl_open(xlsx_file) # (not yet saved) Workbook example wb <- wb_workbook() x <- mtcars[1:6, ] wb$add_worksheet(\"Cars\") wb$add_data(\"Cars\", x, start_col = 2, start_row = 3, row_names = TRUE) xl_open(wb) } # }"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":null,"dir":"Reference","previous_headings":"","what":"append xml child to node — xml_add_child","title":"append xml child to node — xml_add_child","text":"append xml child node","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"append xml child to node — xml_add_child","text":"","code":"xml_add_child(xml_node, xml_child, level, pointer = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"append xml child to node — xml_add_child","text":"xml_node xml_node xml_child xml_child level optional level, missing first child picked pointer pointer ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_add_child.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"append xml child to node — xml_add_child","text":"","code":"xml_node <- \"<\/a>\" xml_child <- \"\" # add child to first level node xml_add_child(xml_node, xml_child) #> [1] \"<\/a>\" # add child to second level node as request xml_node <- xml_add_child(xml_node, xml_child, level = c(\"b\")) # add child to third level node as request xml_node <- xml_add_child(xml_node, \"\", level = c(\"b\", \"c\"))"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":null,"dir":"Reference","previous_headings":"","what":"adds or updates attribute(s) in existing xml node — xml_attr_mod","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"Needs xml node named character vector input. Modifies arguments first child found xml node adds updates attribute vector.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"","code":"xml_attr_mod( xml_content, xml_attributes, escapes = FALSE, declaration = FALSE, remove_empty_attr = TRUE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"xml_content valid xml_node xml_attributes R vector named attributes escapes bool escapes used declaration bool declaration imported remove_empty_attr bool remove empty attributes ignore ","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"named attribute xml_attributes \"\" remove attribute node. xml_attributes contains named entry found xml node, updated else added attribute.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_attr_mod.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"adds or updates attribute(s) in existing xml node — xml_attr_mod","text":"","code":"# add single node xml_node <- \"openxlsx2<\/a>\" xml_attr <- c(qux = \"quux\") # \"openxlsx2<\/a>\" xml_attr_mod(xml_node, xml_attr) #> [1] \"openxlsx2<\/a>\" # update node and add node xml_node <- \"openxlsx2<\/a>\" xml_attr <- c(foo = \"baz\", qux = \"quux\") # \"openxlsx2<\/a>\" xml_attr_mod(xml_node, xml_attr) #> [1] \"openxlsx2<\/a>\" # remove node and add node xml_node <- \"openxlsx2<\/a>\" xml_attr <- c(foo = \"\", qux = \"quux\") # \"openxlsx2<\/a>\" xml_attr_mod(xml_node, xml_attr) #> [1] \"openxlsx2<\/a>\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":null,"dir":"Reference","previous_headings":"","what":"create xml_node from R objects — xml_node_create","title":"create xml_node from R objects — xml_node_create","text":"takes xml_name, xml_children xml_attributes create new xml_node.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create xml_node from R objects — xml_node_create","text":"","code":"xml_node_create( xml_name, xml_children = NULL, xml_attributes = NULL, escapes = FALSE, declaration = FALSE )"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create xml_node from R objects — xml_node_create","text":"xml_name name new xml_node xml_children character vector children attached xml_node xml_attributes named character vector attributes xml_node escapes bool escapes used declaration bool declaration imported","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"create xml_node from R objects — xml_node_create","text":"xml_children xml_attributes empty, use NULL","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_node_create.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create xml_node from R objects — xml_node_create","text":"","code":"xml_name <- \"a\" # \"\" xml_node_create(xml_name) #> [1] \"\" xml_child <- \"openxlsx\" # \"openxlsx<\/a>\" xml_node_create(xml_name, xml_children = xml_child) #> [1] \"openxlsx<\/a>\" xml_attr <- c(foo = \"baz\", qux = \"quux\") # \"\" xml_node_create(xml_name, xml_attributes = xml_attr) #> [1] \"\" # \"openxlsx<\/a>\" xml_node_create(xml_name, xml_children = xml_child, xml_attributes = xml_attr) #> [1] \"openxlsx<\/a>\""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":null,"dir":"Reference","previous_headings":"","what":"remove xml child to node — xml_rm_child","title":"remove xml child to node — xml_rm_child","text":"remove xml child node","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"remove xml child to node — xml_rm_child","text":"","code":"xml_rm_child(xml_node, xml_child, level, which = 0, pointer = FALSE, ...)"},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"remove xml child to node — xml_rm_child","text":"xml_node xml_node xml_child xml_child level optional level, missing first child picked optional index node remove, multiple available. Default disabled removed pointer pointer ... additional arguments passed read_xml()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/reference/xml_rm_child.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"remove xml child to node — xml_rm_child","text":"","code":"xml_node <- \"<\/c><\/b><\/a>\" xml_child <- \"c\" xml_rm_child(xml_node, xml_child) #> [1] \"<\/c><\/b><\/a>\" xml_rm_child(xml_node, xml_child, level = c(\"b\")) #> [1] \"<\/a>\" xml_rm_child(xml_node, \"d\", level = c(\"b\", \"c\")) #> [1] \"<\/b><\/a>\""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-development-version","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 (development version)","text":"Add new params wb_add_pivot_table(). now possible set show_data_as value set tabular table design. 833","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-development-version","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 (development version)","text":"Previously formulas written data frames xml escaped. 834 Improve drawing relationship id selection cause issues unordered relationship ids loaded workbooks. 838 Improve copying cells transpose mode hyperlinks. 850 Options openxlsx2.maxWidth openxlsx2.minWidth now respected documented setting column widths wb_set_col_widths(). 847","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-11","dir":"Changelog","previous_headings":"","what":"openxlsx2 1.1","title":"openxlsx2 1.1","text":"CRAN release: 2023-10-23","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-1-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 1.1","text":"Basic support cloning worksheets across workbooks added wb_clone_worksheet(). work tabular formula data, images charts. Support complex worksheets known pending. 622 Enable loading workbooks without sheets wb_load(sheet = NULL). helpful sheets contain lot data general workbook data interest. 810 longer needed manually create columns wb_group_cols(). 781 now possible sort pivot tables created wb_add_pivot_table(). 795 Basic support xlsb file format. parse binary file format pseudo-openxml files can import. Therefore, importing, possible interact file provided xlsx first place. course slower reading directly binary file. implementation also still missing features: array formulas still broken, conditional formatting data validation implemented, pivot tables slicers. 688 Please note openxlsx2 security tool xlsb parser written intention reading valid xlsb files little endian systems. Please raise issues xlsb terms speed completeness features openxml standard. access file conversion tools, spreadsheet software, may provide better solution needs. Writing xlsb files outside scope project. New set function wb_get_properties()/wb_set_properties() view modify workbook properties. 782 subsequently improved handle workbook properties like company manager. (799, @olivroy) Basic (experimental) support add slicers pivot tables created openxlsx2. 822","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-1-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 1.1","text":"Removing worksheet active tab longer result warnings spreadsheet software. 792 update_table() works now without table autofilter. 802","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-10","dir":"Changelog","previous_headings":"","what":"openxlsx2 1.0","title":"openxlsx2 1.0","text":"CRAN release: 2023-08-25","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-1-0","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 1.0","text":"Use wb_get_sheet_names(), wb_get_active_sheet(), wb_get_selected() instead. wbChartSheet now internal (760, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"deprecated-functions-1-0","dir":"Changelog","previous_headings":"","what":"Deprecated functions","title":"openxlsx2 1.0","text":"functions longer recommended. guide created help users continue work time, changing newer functions recommended. delete_data() deprecated favor wb_remove_tables() wb_clean_sheet() create_comment() deprecated favor wb_comment(). Note wb_comment() new defaults, behavior create_comment() changed. (758, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-1-0","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 1.0","text":"wb_comment() new helper function help create wbComment objects similar create_comment(), following differences: author looks options(\"openxlsx2.creator\"); (create_comment() used sys.getenv(\"USERNAME\") / Sys.getenv(\"USER\")) visible defaults FALSE account modern spreadsheet software behavior. (create_comment(), TRUE). width height must now length 1. (create_comment(), first element taken, ignored.) wb_get_sheet_names() gains escape argument allow special XML characters escaped. 252 wb_color() now accepts hex colors leading sharp (e.g. “#FFFFF”) 728. wb_merge_cells() gains solve argument. allows solve cell intersecting regions. 733 wb_add_comment(comment = \"x\") longer errors comment character vector longer fails (758, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"documentation-improvement-1-0","dir":"Changelog","previous_headings":"","what":"Documentation improvement","title":"openxlsx2 1.0","text":"Tweaks documentation vignettes make consistent.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-1-0","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 1.0","text":"wb_to_df() now handles date1904 detection. Previous results somewhat rare file type using default timezone origin 1900-01-01. 737 workbooks threaded comments 731 workbooks embeddings docx 732 workbooks long hyperlinks 753 wb_load() adds path wbWorkbook object. 741 wb_set_header_footer() now works special characters 747","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-1-0","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 1.0","text":"wb_get_active_sheet(), wb_set_active_sheet(), wb_get_selected() wb_set_selected(), wb_get_named_regions() now wrapper functions. 735","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-08","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.8","title":"openxlsx2 0.8","text":"CRAN release: 2023-08-07","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"api-change-0-8","dir":"Changelog","previous_headings":"","what":"API Change","title":"openxlsx2 0.8","text":"Function arguments now defaulting snake_case. time , arguments accepted camelCase switched snake_case hood. examples currently still displaying camelCase maybe camelCase function slipped . 678 write_formula(), write_data(), write_datatable(), write_comment() longer recommended, Use wb_add_formula(), wb_add_data(), wb_add_data_table(), wb_add_comment() instead.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-8","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.8","text":"Order arguments wb_add_named_region() changed, previously overlooked dims argument added. various functions order dims changed, highlight ’s importance Cleanups remove deprecated functions remove deprecated arguments xy argument arguments col, row, cols, rows. start_col, start_row gridExpand deprecated favor dims. Row column vectors can converted dims using wb_dims(). xlsx_file favor file wb_to_df() deprecating function convertToExcelDate() convert_to_excel_date() wb_grid_lines() wb_set_grid_lines() make get_cell_refs(), get_date_origin(), guess_col_type(), write_file(), dataframe_to_dims(), dims_to_dataframe(), wb_get_sheet_name() internal functions make classes styles_mgr(), wbSheetData, wbWorksheet, wbComment, wbHyperlink internal","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-8","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.8","text":"wb_dims(1:5, letters) wb_dims(1:5, 1:26) wb_dims(x = matrix(1, 5, 26)) wb_dims(x = mtcars, from_col = \"C\", from_row = 2, row_names = TRUE) Handling thread comments now possible via wb_add_thread(). includes options reply resolve comments.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-8","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.8","text":"Improve show_formula. Previously called early function skipped cases. 715","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"refactoring-0-8","dir":"Changelog","previous_headings":"","what":"Refactoring","title":"openxlsx2 0.8","text":"Cleanup / revisit documentation vignettes (682, @olivroy) function index improved. (717, @olivroy)","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-071","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.7.1","title":"openxlsx2 0.7.1","text":"CRAN release: 2023-06-30","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-7-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.7.1","text":"now possible apply specific theme workbook. 630 Removed former example files updated code use new default example. changes internal testing run locally online external files required. reduces package footprint little, 1MB xlsx files now excluded. 632 handling fmt_txt() objects improved. now creates objects class fmt_txt print(), +, .character() methods. objects can now also used text create_comment(). 636 Improve support inputs labels attribute. e.g. factor label numeric, now try write label number. impact way partially labeled variables written. 639 Added new wrapper function wb_add_named_style() supports pre-defined theme aware cell styles like Title Note. addition loading cell styles improved additional custom cell styles available well. 628 Provide additional options write special characters non-unicode environments. 641 Add wb_add_dxfs_style() single line wrapper create dxf styles used conditional formatting custom table styles. 665","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-7-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.7.1","text":"load app.xml now assigned wb$app. Previously loaded assigned. 629 Previously wb_to_df() used argument cols, columns missing created end output frame. Now columns returned ordered. 631 Fix bug wb_load() modifying cell range conditional formatting. 647","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-7-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.7.1","text":"Order arguments wb_add_conditional_formatting() changed, previously overlooked dims argument added. 642 New argument gradientFill added create_dxfs_style(). 651 Special characters now escaped conditional formatting. Hence, previously manually escaped conditional formatting needs updates. 666","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-07","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.7","title":"openxlsx2 0.7","text":"CRAN release: 2023-05-26","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-7","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.7","text":"dims argument wb_add_formula() can used create array references. new cm argument added might useful, formulas previously created addition @ spreadsheet software. Examples use formulas added new vignette. 593 Allow using custom data table styles. fixes minor style inconsistencies. 594 Allow reading writing hms columns. 601 Import tableStyles wb_load() improve dxf style creation. 603 Add fmt_txt() style character strings. 607 Add new wrapper ignore worksheet errors wb_add_ignore_error(). 617 Add new wrapper update table references wb_update_table(). 606","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-7","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.7","text":"Improve handling non standard OutDec options. 611 openxlsx2 now better job trying return character values classes foreign . going quite time, although previously bug treated classes numeric, resulting corrupted xlsx files. 615 now return additional xml arguments worksheets. 617","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-061","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.6.1","title":"openxlsx2 0.6.1","text":"CRAN release: 2023-04-21","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-6-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.6.1","text":"Improve col2int() accept column ranges like col2int(\":Z\"). allow using column ranges various places like wb_merge_cells(cols = \"B:D\", ...) wb_read(cols = c(\"\",\"C:D\")). 575 Add dims argument wb_add_image() wb_add_plot(). can used place images starting cell span cell range. deprecates xy wb_add_plot(). adds colOffset rowOffset wb_add_drawing() wb_add_mschart() wb_add_chart_xml(). 578 Add skipHiddenCols skipHiddenRows wb_to_df(). way, hidden columns rows ignored, assuming person hidden assumes important. 579 writing tibble use .data.frame() just like data.table case. 582 Add cleanup internal comment code write_comment(). impact workbook wrapper code wb_add_comment(). 586 Added chain functions wb_to_df() wb_load(). 587","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-06","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.6","title":"openxlsx2 0.6","text":"CRAN release: 2023-04-02","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-6","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.6","text":"Styles arguments now accept logical numeric arguments applicable. 558 Adding dims argument wb_clean_sheet(). allows clean selected range. 563","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-6","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.6","text":"na.strings = NULL longer ignored write_xlsx() 552 Explicit type conversion date datetime finally available. 551","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-6","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.6","text":"skipEmptyCols skipEmptyRows behavior wb_to_df() related functions switched include empty columns name. Previously exclude columns empty, even name. 555 Cleanups 548 cloneSheetStyle() get_cell_style() set_cell_style() wb_conditional_formatting() xy argument write_data_table() interacting functions file xl_open() definedName wb_to_df() interacting functions get_named_regions() wb_get_named_regions()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-051","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.5.1","title":"openxlsx2 0.5.1","text":"CRAN release: 2023-02-26","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-5-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.5.1","text":"Allow hierarchical grouping. wb_group_cols/wb_group_rows now accept nested lists grouping variable. 537 now possible add form control types Checkbox, Radio Drop workbook using wb_add_form_control(). 533 Improve wb_to_df(fillMergedCells = TRUE) work better dimensions. now possible fill cells merged cells intersect selected dimensions. 541 Speedup cell initialization. used wb_style functions like wb_add_numfmt(). previous loop replaced faster implementation. 545 Improve date detection wb_to_df(). improves date posix detection custom date formats. 547 na_strings() now used explicit default value na.strings parameters exported workbook functions. 473 waiver functions (.e., next_worksheet(), current_worksheet(), na_strings()) now exports 474","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-5-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.5.1","text":"Fixed bug loading input multiple sheets every sheet contains drawing/comment. Previously assumed every sheet comment ordered incorrectly. caused confusion spreadsheet software. 536 Fixed bug files containing 10 external references. case load references numeric order instead “1.xml”, “10.xml”, …, “2.xml”, … jumbled external references. 538","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-05","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.5","title":"openxlsx2 0.5","text":"CRAN release: 2023-01-29","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-5","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.5","text":"Improve column row grouping. now possible group list, can create various levels groupings. 486 writeData() calls force(x) evaluate object options set (#264) tabColor wb_add_worksheet() now allows passing wb_color(). 500 Add wb_copy_cells() wrapper allows copying cell ranges workbook direct copy, reference value. 515 Experimental option: openxlsx2.string_nums write string numerics differently. string numeric numeric string like: .character(1.5). option can 0 = current default. Writes string numeric string (incorrect way according spreadsheet software) 1 = writes string numeric numeric character flag (correct way according spreadsheet software) 2 = convert string numeric numeric writing experimental, impact somewhat unknown. might trigger unintended side effects. Feedback requested. Enable writing strings sharedStrings argument inline_strings = FALSE. creates sharedStrings table openxml allows reuse strings workbook efficiently can reduce file size workbook many cells duplicates. 499 Initial implementation wb_add_pivot_table(). allows adding native pivot tables openxlsx2 workbooks. pivot table area remain empty sheet opened spreadsheet software evaluated successfully. feature newly developed can cause unexpected side effects. aware using might currently break workbooks.","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-5","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.5","text":"Reading files frozen panes one section node restored. 495 Fixed copy paste mistake add_border() used left borders right borders. 496 Improve XML unescaping. 497 Fix reading saving workbooks multiple slicers per sheet. 505 Fix tab selection always selecting first sheet since #303. 506","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-5","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.5","text":"export write_data2() anymore. used development early stages package used directly anymore. documentation: openxlsx2 defaults American English ‘color’ now . Though, fully support previous ‘colour’. Users adjust code. documentation lists color, can pass colour just way used . 501 502","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-041","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.4.1","title":"openxlsx2 0.4.1","text":"CRAN release: 2022-12-18","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-4-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.4.1","text":"Provide new argument calc_chain wb_load(). set FALSE per default, ignore calculation chain found. change reflects files imported third party spreadsheet software visible user. 461 Tweaks wb_data(). Dims now optional select data similar wb_to_df(), similar allows passing wb_to_df() arguments. Though, probably good idea creative passing arguments, result usable wb_data object. 462 Add hidden argument change default heights NULL set_row_heights(). allows changing row height /hiding selected rows. yet provide way hide rows per default. 475 Add wb_add_chartsheet() chart sheet support. Along internal cleanup around chart sheet code. 466","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-4-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.4.1","text":"Fix wb_freeze_pane(). changes load logic bit. Previously put everything sheetViews (frozen pane part ). Though wb_freeze_pane() assumes freezePane used. now try smart split sheetViews upon loading. 465 Previously, adding mschart objects sheets possible (1) worksheet already contained drawing (workbook loaded) (2) last sheet workbook. now fixed. Adding mschart objects worksheet workbook now possible intended. 458 Really fix double xml escaping saving. 467 Improving drawing logic. workbooks various drawings per sheet previously combinations possible reflecting . 478","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-04","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.4","title":"openxlsx2 0.4","text":"CRAN release: 2022-12-05","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-4","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.4","text":"Provide rvg support via wb_add_drawing(). allows integrating rvg plots xlsx files. 449 Improve print options. Defaults printing grid lines, worksheet contains grid lines. 440 Support reading files form control. 426 Handle input files chart extensions. 443 Improve writing styles workbook. Previously every cell checked, changed check unique styles. 423 Implement reading custom file properties. 418 Improved add_named_region(). function includes now various xml options. 386 Add … argument read_xlsx() wb_read(). 381 Allow reading files xml namespace created third party software. 405","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-4","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.4","text":"Update remove calculation chain overwriting formulas workbook. 438 Fix double xml escaping saving. 435 Minor tweak POSIXct dates try avoid notorious 29Feb1900. 424 Implement reading customXml folder input files connection. 419 Fixed saving files tag. Previously wrapped second sheetPr node. issue occurs xlsm files . 417 Fixed case embedded files assigned incorrectly worksheet relationships. caused corrupted output. 403","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-4","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.4","text":"Remove merge_ functions styles. 450 Previously loaded workbook contained formulas pointing cells modified openxlsx2, formulas updated, workbook opened spreadsheet software. now enforced, unless option openxlsx2.disableFullCalcOnLoad set. case respect original calculation properties workbook. wb_save() longer returns path object saved , instead wbWorkbook object, invisibly. consistent behavior others wrappers. 378 Remove never used .equal.wbWorkbook(). idea nice, never developed something useful. Remove never used wb_chart_sheet() function. 399","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-4","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.4","text":"Provide set_sheetview() sheets. Can used provide wbWorkbook function wrapper future. 399","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-031","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.3.1","title":"openxlsx2 0.3.1","text":"CRAN release: 2022-10-31","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-3-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.3.1","text":"Functions adding data workbook now bring applyCellStyle argument. TRUE openxlsx2 apply numeric style, FALSE simply add numeric value without additional styling use previous cell style. 365 Reading file workbook showFormula now returns formulas found workbook. Previously type e str returned. Now able see formulas like hyperlinks . 352","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.3.1","text":"Moved data validation list x14 data validation. enables data validation lists without x14 extension openxlsx 386. 347 Removed build_cell_merges() replaced plain R solution. 390","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-3-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.3.1","text":"Improvements setting column widths. Previously values set set_col_widths() little . now improved. still corner cases column width set openxlsx2 match shown spreadsheet software. Notable differences can seen floating point values (e.g., 10L works 10.1 slightly ) column width Mac. 350 Improve rowNames writing data worksheet. Previously name rownames column defaulted 1. changed. Now data defaults empty cell data table defaults _rowNames_. 375 Fix workbook xml relationship file include reference shared strings per default. solves 360 plain data files written openxlsx2. 363 Adding cell styles streamlined increase consistency. includes style functions like wb_add_font() covers cases hyperlinks. 365 Fix cloning pivot charts. 361 Fix loading writing files slicers. Loading add empty slicer xml files Content_Types workbook.xml.rels. 361 Align logic writing data empty worksheets updating/writing worksheets data. removes update_cell_loop() changes update_cell() behaves. remove duplicated code, also brings great speed improvements (issue 356). 356 now possible use special characters formulas without coding. Previously & encoded like & 251","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.3.1","text":"Previously deprecated names.wbWorkbook() names<-.wbWorkbook() removed. 367 Conditional style defaults create_dxfs_style() changed permissive. Previously shipped default font, default font size font color. changed better reflect behavior user expects. 343","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-03","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.3","title":"openxlsx2 0.3","text":"CRAN release: 2022-09-30","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-3","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.3","text":"New argument startCol read data frame functions wb_to_df(), wb_read() read_xlsx(). 330 New function wb_colour() ease working color vectors used openxlsx2 styles. 292 Deprecated get_cell_style() set_cell_style() favor newly introduced wrapper functions wb_get_cell_style() wb_set_cell_style(). 306 Improvements wb_clone_worksheet(). Cloning chartsheets well worksheets containing charts, pivot tables, drawings tables now possible tweaked. Slicers removed cloned worksheet. 305 Allow writing class data.table. 313 Provide na.numbers reading functions, convert numbers NA R output. Handle na.strings write_xlsx(). 301 Add new option add sparklines various style options worksheets: wb_add_sparklines(). Sparklines can created create_sparklines(). manual page contains example. 280 Add new options data validation. allow type custom, add arguments errorStyle, errorTitle, error, promptTitle, prompt. 271 Provide wb_clone_sheet_style(). improves upon now deprecatedcloneSheetStyle() existed early draft. 233 wb$add_data() now checks earlier missing x argument. 246","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-3","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.3","text":"Worksheets added wbWorkbook longer contain default references drawings vmlDrawings directories. Previously, references added rId1 rId2 even worksheet contain drawing (e.g., image chart) vml drawing (e.g., comment button). cases certain third party software, strictly following references worksheet Content_Types complained missing files import files failed completely. 311 Implement loading user defined chartShapes. Previously implemented instead previous logic assumed every sheet matching drawing. chartShapes longer true. number drawings number worksheets/chartsheets must match. 323 loading files charts, now imported wbWorkbook object. Previously simply copied. allow easier interaction charts future. 304 Moving data validation code workbook worksheet. Also, data_validation_list() longer stored dataValidationLst. moved extLst, fixing bug saving adding another data validation list. code retrieving date origin workbook improved get_date_origin(wb, origin = TRUE) now returns origin integer wbWorkbook. 299 Removed level4 XML functions. single use case level4 function solved differently. level4 needed, can solved using level3 additional level2 functions. addition xml_nodes now return nodes reachable nestings, therefore xml_node(\"<\/><\/>\", \"\") now return character vector length two. xml_node(\"<\/>\", \"\") single character vector returned. 280 Changes various internal pugixml functions, improve handling XML strings. 279 Provide internal helper xml_rm_child() remove children XML strings. 273 Fixes bug update_cell() slowed writing worksheets data. addition, function cleaned improved. longer exported, users need use wb_add_data() write_data(), calls update_cell() hood. 275 276 Various (mostly internal) changes conditional_formatting. Created style_mgr integration dxf (cf-styles) cleaned internal code. syntax changed slightly, see conditional formatting vignette reference. Add whitespace argument read_xml(). 268","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-3","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.3","text":"Order arguments reading functions wb_to_df(), wb_read() read_xls() changed.","code":""},{"path":[]},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"new-features-0-2-1","dir":"Changelog","previous_headings":"","what":"New features","title":"openxlsx2 0.2.1","text":"Data adding functions now ship dims argument can used determine startCol startRow x object added worksheet. Works add_data(), add_data_table(), add_formula() underlying write_ functions well wrappers. Provide optional na.strings argument writing data sheets. can used add custom character string writing numeric data. Improve writing NA, NaN, -Inf/Inf. NA converted #N/; NaN converted #VALUE!; Inf converted #NUM!. conversion applied reading workbook. 256 Many wbWorkbook methods now contain default sheet values current_sheet() next_sheet() (e.g., $add_worksheet(sheet = next_sheet()), $write_data(sheet = curret_sheet()). internal waiver functions allow wbWorkbook object use default expectations sheet interact . allows easier workflow wb$add_worksheet()$add_data(x = data.frame()) $add_worksheet() knows add new worksheet (default name), sets new worksheet current worksheet, $add_data() picks new sheet places data . 165, 179 New functions wb_add_cell_style() wb$add_cell_style() simplify creation cell styles cells sheet. provides fast way create cell styles regions worksheet. cells cell format created must already exist worksheet. cells already contain cell format, preserved, except updated cell format entries, always created. function applied continuous cell worksheet. 230 New functions wb_add_numfmt() wb$add_numfmt() simplify creation number formats cells sheet. provides fast way create number formats regions worksheet. cells number format created must already exist worksheet. cells already contain cell style, preserved, except number format, always created. function applied continuous cell worksheet. 229 New functions wb_add_font() wb$add_font() simplify creation fonts cells sheet. provides fast way create fonts regions worksheet. cells font created must already exist worksheet. cells already contain cell style, preserved, except font, always created. function applied continuous cell worksheet. 228 New functions wb_add_fill() wb$add_fill() simplify creation fills cells sheet. provides fast way create color filled regions worksheet. cells fill created must already exist worksheet. cells already contain cell style, preserved, except filled color, always created. function applied continuous cell worksheet allows change color every n-th column row. 222 New functions wb_add_border() wb$add_border() simplify creation borders cells sheet. especially useful creating surrounding borders different border styles various cells. cells border created must already exist worksheet. cells already contain cell style, preserved, except border, always created. function applied continuous cell worksheet allows change horizontal vertical internal border grid independently. 220 Enable reading tables wb_to_df(). Tables handled similar defined names. 193 Several enhancements added checking validation worksheet names 165 adding new worksheet via wbWorkbook$add_worksheet() provided name checked illegal characters (see note Breaking changes) wbWorkbook$get_sheet_names() (wb_get_sheet_names() wrapper) added. return formatted original sheet names make names.wbWorkbook() names<-.wbWorkbook() deprecated wbWorkbook$setSheetName() deprecated clean_worksheet_names() added support removing characters allowed worksheet names","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"fixes-0-2-1","dir":"Changelog","previous_headings":"","what":"Fixes","title":"openxlsx2 0.2.1","text":"Various fixes enable handling non unicode R environments 243 Fix issue broken pageSetup reference causing corrupt excel files 216 Fix reading writing comments workbooks already provide comments 209 Fix issue broken xml Excels vml files enable opening xlsm files wb$open() 202 Fix reading writing non UTF-8 systems 198 199 207 Instruct parser import nodes whitespaces. fixes complaint spreadsheet software. 189 Fix reading file without row attribute. 187 190 Remove reference printerSettings.bin loading. binary blob included reference caused file corruption warnings. 185 Fix loading writing xlsx files workbook$extLst. Previously loaded sheet contains slicer, second extLst added confused spreadsheet software. Now combined single node. Fix writing xlsx file multiple entries conditional formatting type databar sheet. 174 Cell fields cm, ph vm now implemented reading writing. first step handle functions use metadata. 173 wbWorkbook: $open() longer overwrites $path field temporary file 171 xl_open() works (better) Windows 170","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"breaking-changes-0-2-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"openxlsx2 0.2.1","text":"writing existing workbooks, default value removeCellStyle now FALSE. Therefore cell contains style, attempted replace value, style cell . wb_conditional_formatting() deprecated favor wb_add_conditional_formatting() wbWorkbook$add_conditional_formatting(). type must now match exactly one : \"expression\", \"colorScale\", \"dataBar\", \"duplicatedValues\", \"containsText\", \"notContainsText\", \"beginsWith\", \"endsWith\", \"\", \"topN\", \"bottomN\" Assigning new worksheet illegal character now prompts error 165. See ?clean_worksheet_name easy method replacing bad characters. openxlsx2Coerce() (called x objects adding data workbook) removed. Users can longer pass arbitrary objects need format objects appropriately rely .data.frame methods 167 xl_open(file = ) longer valid throw warning; first argument changes x highlight xl_open() can called file path wbWorkbook object 171","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"internal-changes-0-2-1","dir":"Changelog","previous_headings":"","what":"Internal changes","title":"openxlsx2 0.2.1","text":"Remove wb$createFontNode() never used. Switch modern xlsx template, creating workbooks. Imported workbooks use imported template Rewrite wb$tables use data frame approach. simplifies code bit makes easier implement upcoming changes 191 Update internal pugixml library two functions write_data() write_datatable() now use internal function write_data_table() add data sheet. simplifies code ensures functions tested. pull request, documentation updated stack= option, present , removed 175 wbWorkbook$validate_sheet() added object methods private wbWorkbook field original_sheet_names added track original names passed sheets private $get_sheet() removed favor explicit private wbWorkbook methods additions: $get_sheet_id_max(), $get_sheet_index() getting ids $get_sheet_name() getting sheet name $set_single_sheet_name() setting sheet names $pappend() general private appending $validate_new_sheet() checking new sheet names $append_workbook_field() self$workbook[[field]] $append_sheet_rels() self$worksheet_rels[[sheet]] $get_worksheet() replace $ws()","code":""},{"path":"https://janmarvin.github.io/openxlsx2/dev/news/index.html","id":"openxlsx2-020","dir":"Changelog","previous_headings":"","what":"openxlsx2 0.2.0","title":"openxlsx2 0.2.0","text":"Added NEWS.md file track changes package. First public release","code":""}]