diff --git a/pkgdown.yml b/pkgdown.yml index 5d8e4fa..74d7e79 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.1.11 pkgdown: 2.1.1 pkgdown_sha: ~ articles: {} -last_built: 2024-12-06T14:53Z +last_built: 2024-12-06T18:36Z urls: reference: https://elipousson.github.io/openxlsx2Extras/reference article: https://elipousson.github.io/openxlsx2Extras/articles diff --git a/reference/wb_split.html b/reference/wb_split.html index 856f2c1..96b693b 100644 --- a/reference/wb_split.html +++ b/reference/wb_split.html @@ -73,8 +73,42 @@

Exampleswb <- as_wb(list(mtcars, mtcars)) wb_split(wb, .key = carb) -#> Warning: unused arguments (wb) -#> Error in (function (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, check_names = FALSE, show_hyperlinks = FALSE, ...) { xlsx_file <- list(...)$xlsx_file standardize_case_names(...) if (!is.null(xlsx_file)) { .Deprecated(old = "xlsx_file", new = "file", package = "openxlsx2") file <- xlsx_file %||% file } if (!is.null(cols)) cols <- col2int(cols) if (inherits(file, "wbWorkbook")) { wb <- file } else { if (missing(sheet)) sheet <- substitute() data_only <- TRUE if (!missing(named_region) || show_hyperlinks) data_only <- FALSE wb <- wb_load(file, sheet = sheet, data_only = data_only) } if (!missing(named_region)) { nr <- wb$get_named_regions(tables = TRUE) if ((named_region %in% nr$name) && missing(sheet)) { sel <- nr[nr$name == named_region, ][1, ] sheet <- sel$sheet dims <- sel$coords } else if (named_region %in% nr$name) { sel <- nr[nr$name == named_region & nr$sheet == wb_validate_sheet(wb, sheet), ] if (NROW(sel) == 0) { stop("no such named_region on selected sheet") } dims <- sel$coords } else { stop("no such named_region") } } if (missing(sheet)) { sheet <- 1 } if (is.character(sheet)) { sheet <- wb_validate_sheet(wb, sheet) } if (is.null(wb$worksheets[[sheet]]$sheet_data$cc) || nrow(wb$worksheets[[sheet]]$sheet_data$cc) == 0) { message("sheet found, but contains no data") return(NULL) } if (missing(named_region) && missing(dims)) { sd <- wb$worksheets[[sheet]]$sheet_data$cc[c("row_r", "c_r")] sd$row <- as.integer(sd$row_r) sd$col <- col2int(sd$c_r) dims <- paste0(int2col(min(sd$col)), min(sd$row), ":", int2col(max(sd$col)), max(sd$row)) } row_attr <- wb$worksheets[[sheet]]$sheet_data$row_attr cc <- wb$worksheets[[sheet]]$sheet_data$cc sst <- attr(wb$sharedStrings, "text") rnams <- row_attr$r numfmt_date <- numfmt_is_date(wb$styles_mgr$styles$numFmts) xlsx_date_style <- style_is_date(wb$styles_mgr$styles$cellXfs, numfmt_date) numfmt_hms <- numfmt_is_hms(wb$styles_mgr$styles$numFmts) xlsx_hms_style <- style_is_hms(wb$styles_mgr$styles$cellXfs, numfmt_hms) numfmt_posix <- numfmt_is_posix(wb$styles_mgr$styles$numFmts) xlsx_posix_style <- style_is_posix(wb$styles_mgr$styles$cellXfs, numfmt_posix) z <- dims_to_dataframe(dims, empty_rm = TRUE) tt <- copy(z) keep_cols <- colnames(z) keep_rows <- rownames(z) maxRow <- max(as.numeric(keep_rows)) maxCol <- max(col2int(keep_cols)) if (start_row > 1) { keep_rows <- as.character(seq(start_row, maxRow)) if (start_row <= maxRow) { z <- z[rownames(z) %in% keep_rows, , drop = FALSE] tt <- tt[rownames(tt) %in% keep_rows, , drop = FALSE] } else { keep_rows <- as.character(start_row) z <- z[keep_rows, , drop = FALSE] tt <- tt[keep_rows, , drop = FALSE] rownames(z) <- as.integer(keep_rows) rownames(tt) <- as.integer(keep_rows) } } if (!is.null(rows)) { keep_rows <- as.character(as.integer(rows)) if (all(keep_rows %in% rownames(z))) { z <- z[rownames(z) %in% keep_rows, , drop = FALSE] tt <- tt[rownames(tt) %in% keep_rows, , drop = FALSE] } else { z <- z[keep_rows, , drop = FALSE] tt <- tt[keep_rows, , drop = FALSE] rownames(z) <- as.integer(keep_rows) rownames(tt) <- as.integer(keep_rows) } } if (!is.null(start_col)) { keep_cols <- int2col(seq(col2int(start_col), maxCol)) if (!all(keep_cols %in% colnames(z))) { keep_col <- keep_cols[!keep_cols %in% colnames(z)] z[keep_col] <- NA_character_ tt[keep_col] <- NA_character_ z <- z[keep_cols] tt <- tt[keep_cols] } z <- z[, match(keep_cols, colnames(z)), drop = FALSE] tt <- tt[, match(keep_cols, colnames(tt)), drop = FALSE] } if (!is.null(cols)) { keep_cols <- int2col(cols) if (!all(keep_cols %in% colnames(z))) { keep_col <- keep_cols[!keep_cols %in% colnames(z)] z[keep_col] <- NA_character_ tt[keep_col] <- NA_character_ } z <- z[, match(keep_cols, colnames(z)), drop = FALSE] tt <- tt[, match(keep_cols, colnames(tt)), drop = FALSE] } keep_rows <- keep_rows[keep_rows %in% rnams] if (length(keep_rows) && length(keep_cols)) cc <- cc[cc$row_r %in% keep_rows & cc$c_r %in% keep_cols, ] cc$val <- NA_character_ cc$typ <- NA_character_ cc_tab <- unique(cc$c_t) if (any(cc_tab == "b")) { sel <- cc$c_t %in% "b" cc$val[sel] <- as.logical(as.numeric(cc$v[sel])) cc$typ[sel] <- "b" } if (any(cc_tab %in% c("str", "e"))) { sel <- cc$c_t %in% c("str", "e") cc$val[sel] <- replaceXMLEntities(cc$v[sel]) cc$typ[sel] <- "s" } if (any(cc_tab %in% c("inlineStr"))) { sel <- cc$c_t %in% c("inlineStr") cc$val[sel] <- is_to_txt(cc$is[sel]) cc$typ[sel] <- "s" } if (any(cc_tab %in% c("s"))) { sel <- cc$c_t %in% c("s") cc$val[sel] <- sst[as.numeric(cc$v[sel]) + 1] cc$typ[sel] <- "s" } has_na_string <- FALSE if (!all(is.na(na.strings))) { sel <- cc$val %in% na.strings if (any(sel)) { cc$val[sel] <- NA_character_ cc$typ[sel] <- "na_string" has_na_string <- TRUE } } has_na_number <- FALSE na.numbers <- as.character(na.numbers) if (!all(is.na(na.numbers))) { sel <- cc$v %in% na.numbers if (any(sel)) { cc$val[sel] <- NA_character_ cc$typ[sel] <- "na_number" has_na_number <- TRUE } } origin <- get_date_origin(wb) if (!is.null(cc$c_s)) { if (detect_dates && missing(types)) { cc$is_string <- FALSE if (!is.null(cc$c_t)) cc$is_string <- cc$c_t %in% c("s", "str", "b", "inlineStr") if (any(sel <- cc$c_s %in% xlsx_date_style)) { sel <- sel & !cc$is_string & cc$v != "" cc$val[sel] <- suppressWarnings(as.character(convert_date(cc$v[sel], origin = origin))) cc$typ[sel] <- "d" } if (any(sel <- cc$c_s %in% xlsx_hms_style)) { sel <- sel & !cc$is_string & cc$v != "" if (isNamespaceLoaded("hms")) { cc$val[sel] <- cc$v[sel] } else { cc$val[sel] <- suppressWarnings(as.character(convert_hms(cc$v[sel]))) } cc$typ[sel] <- "h" } if (any(sel <- cc$c_s %in% xlsx_posix_style)) { sel <- sel & !cc$is_string & cc$v != "" cc$val[sel] <- suppressWarnings(as.character(convert_datetime(cc$v[sel], origin = origin))) cc$typ[sel] <- "p" } } } if (any(sel <- is.na(cc$typ))) { cc$val[sel] <- cc$v[sel] cc$typ[sel] <- "n" } if (show_formula) { if (any(cc$f_t == "shared")) { cc_shared <- wb$worksheets[[sheet]]$sheet_data$cc cc_shared <- cc_shared[cc_shared$f_t == "shared", ] cc_shared <- cc_shared[order(as.integer(cc_shared$f_si)), ] cc_shared$f <- ave2(cc_shared$f, cc_shared$f_si, carry_forward) cc_shared$cols <- ave2(col2int(cc_shared$c_r), cc_shared$f_si, calc_distance) cc_shared$rows <- ave2(as.integer(cc_shared$row_r), cc_shared$f_si, calc_distance) cells <- find_a1_notation(cc_shared$f) repls <- vector("list", length = length(cells)) for (i in seq_along(cells)) { repls[[i]] <- next_cell(cells[[i]], cc_shared$cols[i], cc_shared$rows[i]) } cc_shared$f <- replace_a1_notation(cc_shared$f, repls) cc_shared$cols <- NULL cc_shared$rows <- NULL cc_shared <- cc_shared[which(cc_shared$r %in% cc$r), ] cc[match(cc_shared$r, cc$r), ] <- cc_shared } sel <- cc$f != "" cc$val[sel] <- replaceXMLEntities(cc$f[sel]) cc$typ[sel] <- "f" } if (show_hyperlinks) { if (length(wb$worksheets[[sheet]]$hyperlinks)) { hls <- wb_to_hyperlink(wb, sheet) hyprlnks <- as.data.frame(do.call("rbind", lapply(hls, function(hl) { c(hl$ref, ifelse(is.null(hl$target), hl$location, hl$target)) }))) cc$val[match(hyprlnks$V1, cc$r)] <- hyprlnks$V2 } } if (has_na_string) cc$typ[cc$typ == "na_string"] <- NA if (has_na_number) cc$typ[cc$typ == "na_number"] <- NA zz <- cc[c("val", "typ")] zz$cols <- NA_integer_ zz$rows <- NA_integer_ zz$cols <- match(cc$c_r, colnames(z)) - 1L zz$rows <- match(cc$row_r, rownames(z)) - 1L zz <- zz[order(zz[, "cols"], zz[, "rows"]), ] if (any(zz$val == "", na.rm = TRUE)) zz <- zz[zz$val != "", ] long_to_wide(z, tt, zz) if (fill_merged_cells) { mc <- wb$worksheets[[sheet]]$mergeCells if (length(mc)) { mc <- unlist(xml_attr(mc, "mergeCell")) for (i in seq_along(mc)) { filler <- stringi::stri_split_fixed(mc[i], pattern = ":")[[1]][1] dms <- dims_to_dataframe(mc[i]) if (any(row_sel <- rownames(z) %in% rownames(dms)) && any(col_sel <- colnames(z) %in% colnames(dms))) { z_fill <- wb_to_df(file = wb, sheet = sheet, dims = filler, na.strings = na.strings, convert = FALSE, col_names = FALSE, detect_dates = detect_dates, show_formula = show_formula, keep_attributes = TRUE) tt_fill <- attr(z_fill, "tt") z[row_sel, col_sel] <- z_fill tt[row_sel, col_sel] <- tt_fill } } } } if (skip_hidden_rows) { sel <- row_attr$hidden == "1" | row_attr$hidden == "true" if (any(sel)) { hide <- !keep_rows %in% row_attr$r[sel] z <- z[hide, , drop = FALSE] tt <- tt[hide, , drop = FALSE] } } if (skip_hidden_cols) { col_attr <- wb$worksheets[[sheet]]$unfold_cols() sel <- col_attr$hidden == "1" | col_attr$hidden == "true" if (any(sel)) { hide <- col2int(keep_cols) %in% as.integer(col_attr$min[sel]) z[hide] <- NULL tt[hide] <- NULL } } if (skip_empty_rows) { empty <- vapply(seq_len(nrow(z)), function(x) all(is.na(z[x, ])), NA) z <- z[!empty, , drop = FALSE] tt <- tt[!empty, , drop = FALSE] } if (skip_empty_cols) { empty <- vapply(z, function(x) all(is.na(x)), NA) if (any(empty)) { sel <- which(empty) z[sel] <- NULL tt[sel] <- NULL } } xlsx_cols_names <- colnames(z) names(xlsx_cols_names) <- xlsx_cols_names if (col_names) { nams <- names(xlsx_cols_names) xlsx_cols_names <- z[1, ] names(xlsx_cols_names) <- nams z <- z[-1, , drop = FALSE] tt <- tt[-1, , drop = FALSE] } if (row_names) { rownames(z) <- z[, 1] rownames(tt) <- z[, 1] xlsx_cols_names <- xlsx_cols_names[-1] z <- z[, -1, drop = FALSE] tt <- tt[, -1, drop = FALSE] } date_conv <- NULL datetime_conv <- NULL hms_conv <- convert_hms if (missing(types)) { types <- guess_col_type(tt) date_conv <- as.Date datetime_conv <- as.POSIXct } else { if (any(xlsx_cols_names %in% names(types))) { if (is.character(types)) { types[types == "character"] <- 0 types[types == "numeric"] <- 1 types[types == "Date"] <- 2 types[types == "POSIXct"] <- 3 types[types == "logical"] <- 4 types[types == "hms"] <- 5 types[types == "formula"] <- 6 } if (any(!names(types) %in% xlsx_cols_names)) { warning("variable from `types` not found in data") types <- types[names(types) %in% xlsx_cols_names] } names(types) <- names(xlsx_cols_names[match(names(types), xlsx_cols_names)]) guess <- guess_col_type(tt) guess[names(types)] <- types types <- guess } else { stop("no variable from `types` found in data") } date_conv <- convert_date datetime_conv <- convert_datetime } if (convert) { sel <- !is.na(names(types)) if (any(sel)) { nums <- names(which(types[sel] == 1)) dtes <- names(which(types[sel] == 2)) poxs <- names(which(types[sel] == 3)) logs <- names(which(types[sel] == 4)) difs <- names(which(types[sel] == 5)) fmls <- names(which(types[sel] == 6)) if (length(nums)) z[nums] <- lapply(z[nums], function(i) as.numeric(replace(i, i == "#NUM!", "NaN"))) if (length(dtes)) z[dtes] <- lapply(z[dtes], date_conv, origin = origin) if (length(poxs)) z[poxs] <- lapply(z[poxs], datetime_conv, origin = origin) if (length(logs)) z[logs] <- lapply(z[logs], as.logical) if (isNamespaceLoaded("hms")) z[difs] <- lapply(z[difs], hms_conv) for (i in seq_along(z)) { if (names(z)[i] %in% fmls) class(z[[i]]) <- c(class(z[[i]]), "formula") } } else { warning("could not convert. All missing in row used for variable names") } } if (col_names) { if (check_names) { xlsx_cols_names <- make.names(xlsx_cols_names, unique = TRUE) } names(z) <- xlsx_cols_names names(tt) <- xlsx_cols_names } if (keep_attributes) { attr(z, "tt") <- tt attr(z, "types") <- types if (!missing(named_region)) attr(z, "dn") <- nr } z})(wb = <environment>, sheet = "Sheet 1"): argument "file" is missing, with no default +#> [[1]] +#> A Workbook object. +#> +#> Worksheets: +#> Sheets: Sheet 1, Sheet 2 +#> Write order: 1, 2 +#> [[2]] +#> A Workbook object. +#> +#> Worksheets: +#> Sheets: Sheet 1, Sheet 2 +#> Write order: 1, 2 +#> [[3]] +#> A Workbook object. +#> +#> Worksheets: +#> Sheets: Sheet 1, Sheet 2 +#> Write order: 1, 2 +#> [[4]] +#> A Workbook object. +#> +#> Worksheets: +#> Sheets: Sheet 1, Sheet 2 +#> Write order: 1, 2 +#> [[5]] +#> A Workbook object. +#> +#> Worksheets: +#> Sheets: Sheet 1, Sheet 2 +#> Write order: 1, 2 +#> [[6]] +#> A Workbook object. +#> +#> Worksheets: +#> Sheets: Sheet 1, Sheet 2 +#> Write order: 1, 2 diff --git a/search.json b/search.json index a314ad4..92b4fe6 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://elipousson.github.io/openxlsx2Extras/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 openxlsx2Extras authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Eli Pousson. Author, maintainer, copyright holder.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Pousson E (2024). openxlsx2Extras: Extra Functions openxlsx2 package. R package version 0.0.0.9000, https://elipousson.github.io/openxlsx2Extras/, https://github.com/elipousson/openxlsx2Extras.","code":"@Manual{, title = {openxlsx2Extras: Extra Functions for the openxlsx2 package}, author = {Eli Pousson}, year = {2024}, note = {R package version 0.0.0.9000, https://elipousson.github.io/openxlsx2Extras/}, url = {https://github.com/elipousson/openxlsx2Extras}, }"},{"path":"https://elipousson.github.io/openxlsx2Extras/index.html","id":"openxlsx2extras","dir":"","previous_headings":"","what":"Extra Functions for the openxlsx2 package","title":"Extra Functions for the openxlsx2 package","text":"goal openxlsx2Extras extend functionality {openxlsx2} R package.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extra Functions for the openxlsx2 package","text":"can install development version openxlsx2Extras like :","code":"pak::pkg_install(\"elipousson/openxlsx2Extras\")"},{"path":"https://elipousson.github.io/openxlsx2Extras/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Extra Functions for the openxlsx2 package","text":"basic example shows use wb_save_ext() set filename based workbook title:","code":"library(openxlsx2) library(openxlsx2Extras) withr::with_tempdir({ wb_workbook( title = \"Title used for output file\" ) |> wb_add_worksheet() |> wb_save_ext() fs::dir_ls() }) #> Title used for output file.xlsx"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"as_sheet_list() prepares list data frames inclusion workbook.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"","code":"as_sheet_list( x, sheet_names = NULL, ..., n_sheets = NULL, .prep_fn = prep_wb_data, repair = \"unique\", default = \"Sheet\", call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"sheet_names One sheet names. Empty values (\"\" \" \") replaced using default parameter value position sheet_names vector. ... Arguments passed prep_wb_data x Required. data frame object coercible data frame base::.data.frame(). list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information. n_sheets Number sheet names return. .prep_fn Function use preparing list input objects. Defaults prep_wb_data(). default Default prefix use numbered sheets. Default values used sheet_names = NULL n_sheets greater length sheet_names. Defaults \"Sheet\".","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"named list data frames.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"","code":"x <- head(mtcars, 1) y <- tail(mtcars, 1) as_sheet_list(x) #> $`Sheet 1` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> as_sheet_list(list(x, y)) #> $`Sheet 1` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> #> $`Sheet 2` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 #> as_sheet_list(list(head = x, tail = y)) #> $head #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> #> $tail #> mpg cyl disp hp drat wt qsec vs am gear carb #> Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 #> as_sheet_list(list(head = x, y)) #> $head #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> #> $`Sheet 2` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 #>"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Coerce a data frame or list of data frames to a workbook — as_wb","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"as_wb() converts data frame list data frames wbWorkbook object.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"","code":"as_wb( x, ..., sheet_names = NULL, creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, properties = NULL, type = c(\"df-list\", \"df\", \"any\"), call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"x Typically, data frame list data frames. wbWorkbook returned -ignoring parameters. type = \"\", x can also object coercible data frame. ... Arguments passed wb_add_data_ext as_table Default FALSE. TRUE, use openxlsx2::wb_add_data_table() add data workbook. FALSE, use openxlsx2::wb_add_data(). Additional parameters ... passed one function depending value. labels Method handling column labels. \"drop\" (default) \"row_before\". \"row_before\", insert column labels row column names. list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. start_row vector specifying starting row write x . sheet_names Optional character vector worksheet names. creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords Additional arguments passed openxlsx2::wb_workbook(). datetime_created time workbook created theme Optional theme identified string number. See Details options. properties named list (typically openxlsx2::wb_get_properties()) used set new workbook properties values set NULL. datetime_created defaults Sys.time() must set NULL inherit value properties. type Type objects allow. \"df-list\" allows data frames lists data frames. \"df\" allows data frames . \"\" allows input (allowing option wb_add_data_ext() coerce objects data frames). call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":[]},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"","code":"as_wb(mtcars) #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1 #> Write order: 1 as_wb(list(mtcars, mtcars)) #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":null,"dir":"Reference","previous_headings":"","what":"Format logical vector columns to use replacement values — fmt_lgl_cols","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":"fmt_lgl_cols() uses vec_fmt_lgl() format (specified) logical vector columns use replacement values.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":"","code":"fmt_lgl_cols( .data, .cols = tidyselect::where(is.logical), values = c(\"Y\", \"N\") )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). See Methods, , details. .cols Columns transform. select grouping columns already automatically handled verb (.e. summarise() mutate()). values Default c(\"Y\", \"N\") Length 2 vector first element replaces TRUE second element replaces FALSE.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":"","code":"fmt_lgl_cols(data.frame(x = c(TRUE, FALSE, TRUE))) #> x #> 1 Y #> 2 N #> 3 Y"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":null,"dir":"Reference","previous_headings":"","what":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"fmt_marquee_txt() uses marquee::marquee_parse() openxlsx2::fmt_txt() format Markdown text.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"","code":"fmt_marquee_txt( text, ..., style = marquee::classic_style(), ignore_html = TRUE )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"text character string. core quality markdown text valid markdown restrictions content ... Ignored time. future use. style style set classic_style() defines text rendered ignore_html HTML code removed output","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"","code":"fmt_marquee_txt( \"# ABC abc\" ) #> [[1]] #> fmt_txt string: #> [1] \"\" #> #> [[2]] #> fmt_txt string: #> [1] \"ABC\" #> #> [[3]] #> fmt_txt string: #> [1] \"abc\" #>"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert an object to a list of workbooks — map_wb","title":"Convert an object to a list of workbooks — map_wb","text":"map_wb() takes list returns list wbWorkbook objects.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert an object to a list of workbooks — map_wb","text":"","code":"map_wb(x, ...)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert an object to a list of workbooks — map_wb","text":"x Typically, data frame list data frames. wbWorkbook returned -ignoring parameters. type = \"\", x can also object coercible data frame. ... Arguments passed as_wb type Type objects allow. \"df-list\" allows data frames lists data frames. \"df\" allows data frames . \"\" allows input (allowing option wb_add_data_ext() coerce objects data frames). sheet_names Optional character vector worksheet names. title,subject,category,keywords Additional arguments passed openxlsx2::wb_workbook(). properties named list (typically openxlsx2::wb_get_properties()) used set new workbook properties values set NULL. datetime_created defaults Sys.time() must set NULL inherit value properties. creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. datetime_created time workbook created theme Optional theme identified string number. See Details options. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert an object to a list of workbooks — map_wb","text":"list wbWorkbook objects.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/openxlsx2Extras-package.html","id":null,"dir":"Reference","previous_headings":"","what":"openxlsx2Extras: Extra Functions for the openxlsx2 package — openxlsx2Extras-package","title":"openxlsx2Extras: Extra Functions for the openxlsx2 package — openxlsx2Extras-package","text":"Extends openxlsx2 package wrapper helper functions designed add new features options working Excel workbooks.","code":""},{"path":[]},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/openxlsx2Extras-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"openxlsx2Extras: Extra Functions for the openxlsx2 package — openxlsx2Extras-package","text":"Maintainer: Eli Pousson eli.pousson@gmail.com (ORCID) [copyright holder]","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Prepare data for adding to a workbook — prep_wb_data","title":"Prepare data for adding to a workbook — prep_wb_data","text":"prep_wb_data() prepares data frame addition workbook handling list columns geometry columns (sf data frames).","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare data for adding to a workbook — prep_wb_data","text":"","code":"prep_wb_data( x, list_columns = c(\"collapse\", \"drop\", \"asis\"), sep = \"; \", geometry = c(\"drop\", \"coords\", \"wkt\"), coords = c(\"lon\", \"lat\"), call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare data for adding to a workbook — prep_wb_data","text":"x Required. data frame object coercible data frame base::.data.frame(). list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Prepare data for adding to a workbook — prep_wb_data","text":"","code":"list_df <- vctrs::data_frame( num = 1, alpha = list(list(\"A\", \"B\", \"C\")) ) prep_wb_data(list_df) #> num alpha #> 1 1 A; B; C prep_wb_data(list_df, list_columns = \"drop\") #> num #> 1 1 prep_wb_data(list_df, list_columns = \"asis\") #> num alpha #> 1 1 list(\"A\", \"B\", \"C\") if (is_installed(\"sf\")) { nc <- sf::read_sf(system.file(\"shape/nc.shp\", package = \"sf\")) prep_wb_data(nc, geometry = \"coords\") prep_wb_data(nc, geometry = \"wkt\") } #> Error in is_installed(\"sf\"): could not find function \"is_installed\""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/read_xlsx_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","title":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","text":"read_xlsx_ext() uses openxlsx2::read_xlsx() allows use name repair argument (\"unique\" default) avoid blank \"\" NA values column names.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/read_xlsx_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","text":"","code":"read_xlsx_ext(file, ..., repair = \"unique\")"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/read_xlsx_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","text":"file xlsx file, wbWorkbook object URL xlsx file. ... Arguments passed openxlsx2::read_xlsx 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. 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. named_region Character string named_region (defined name table). sheet selected, first appearance selected. See wb_get_named_regions() check_names TRUE names variables data frame checked ensure syntactically valid variable names. show_hyperlinks TRUE instead displayed text, hyperlink targets shown. repair Either string function. string, must one \"check_unique\", \"minimal\", \"unique\", \"universal\", \"unique_quiet\", \"universal_quiet\". function, invoked vector minimal names must return minimal names, otherwise error thrown. Minimal names never NULL NA. element name, minimal name empty string. Unique names unique. suffix appended duplicate names make unique. Universal names unique syntactic, meaning can safely use names variables without causing syntax error. \"check_unique\" option perform name repair. Instead, error raised names suit \"unique\" criteria. options \"unique_quiet\" \"universal_quiet\" help user calls function indirectly, via another function exposes repair quiet. Specifying repair = \"unique_quiet\" like specifying repair = \"unique\", quiet = TRUE. \"*_quiet\" options used, setting quiet silently overridden.","code":""},{"path":[]},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_excel_fmt_class.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare a data frame with Excel style class values for formatting by openxlsx2 — set_excel_fmt_class","text":"","code":"set_excel_fmt_class(data, cols, fmt_class = \"currency\", multiple = TRUE)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_excel_fmt_class.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare a data frame with Excel style class values for formatting by openxlsx2 — set_excel_fmt_class","text":"data data frame columns format. cols Column names numbers modify. fmt_class Excel style class, one : c(\"currency\", \"accounting\", \"hyperlink\", \"percentage\", \"scientific\", \"formula\"). Length recycled match length cols using vctrs::vec_recycle(). multiple Whether arg may contain zero several values.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_excel_fmt_class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Prepare a data frame with Excel style class values for formatting by openxlsx2 — set_excel_fmt_class","text":"set_excel_fmt_class() applies style specified column. See openxlsx2 documentation information feature: https://janmarvin.github.io/openxlsx2/articles/openxlsx2_style_manual.html#numfmts2","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Set sheet names for input data — set_sheet_list_names","title":"Set sheet names for input data — set_sheet_list_names","text":"set_sheet_list_names() as_sheet_names() adapted existing functionality handling sheet names openxlsx2::write_xlsx().","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set sheet names for input data — set_sheet_list_names","text":"","code":"set_sheet_list_names( x, sheet_names = NULL, ..., n_sheets = NULL, .prep_fn = prep_wb_data, repair = \"unique\", default = \"Sheet\", call = caller_env() ) as_sheet_names( sheet_names = NULL, n_sheets = 1, default = \"Sheet\", max_length = 31, excess_length = c(\"truncate\", \"error\"), repair = \"unique\", quiet = FALSE, arg = caller_arg(sheet_names), call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Set sheet names for input data — set_sheet_list_names","text":"https://github.com/JanMarvin/openxlsx2/blob/main/R/write_xlsx.R#L281-L301","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set sheet names for input data — set_sheet_list_names","text":"sheet_names One sheet names. Empty values (\"\" \" \") replaced using default parameter value position sheet_names vector. n_sheets Number sheet names return. default Default prefix use numbered sheets. Default values used sheet_names = NULL n_sheets greater length sheet_names. Defaults \"Sheet\". max_length Maximum allowed length characters sheet names. Must 31 less. excess_length Handling sheet names exceed max_length characters. \"truncate\" trims length max_length \"error\" errors.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set sheet names for input data — set_sheet_list_names","text":"","code":"as_sheet_names() #> [1] \"Sheet 1\" as_sheet_names(\"Workbook sheet\") #> [1] \"Workbook sheet\" as_sheet_names(c(\"Workbook sheet\", \"Workbook sheet\"), quiet = TRUE) #> [1] \"Workbook sheet...1\" \"Workbook sheet...2\" as_sheet_names(\"Workbook sheet\", n_sheets = 2) #> [1] \"Workbook sheet\" \"Sheet 2\" as_sheet_names(\"Sheet names longer than 31 characters are truncated\") #> ! Truncating `\"Sheet names longer than 31 characters are truncated\"` values to #> 31 characters. #> [1] \"Sheet names longer than 31 char\""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":null,"dir":"Reference","previous_headings":"","what":"Format a logical vector to specified values — vec_fmt_lgl","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"Format logical vector specified values","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"","code":"vec_fmt_lgl(x, values = c(\"Y\", \"N\"))"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"x logical vector. values Default c(\"Y\", \"N\") Length 2 vector first element replaces TRUE second element replaces FALSE.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"","code":"vec_fmt_lgl(c(TRUE, FALSE)) #> [1] \"Y\" \"N\" vec_fmt_lgl(c(TRUE, FALSE), c(\"Yes\", \"No\")) #> [1] \"Yes\" \"No\""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"wb_add_data_ext() extends openxlsx2::wb_add_data() add data workbook special handling input data geometry list columns (using prep_wb_data()) labelled data.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"","code":"wb_add_data_ext( wb, x, sheet = current_sheet(), ..., start_row = 1, list_columns = c(\"collapse\", \"drop\", \"asis\"), sep = \"; \", geometry = c(\"drop\", \"coords\", \"wkt\"), coords = c(\"lon\", \"lat\"), labels = c(\"drop\", \"row_before\"), as_table = FALSE, call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"wb Workbook object containing worksheet. x Required. data frame object coercible data frame base::.data.frame(). sheet worksheet write . Can worksheet index name. ... Arguments passed openxlsx2::wb_add_data, openxlsx2::wb_add_data_table dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column 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. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default looks options(openxlsx2.na.strings) set. Otherwise na_strings() uses special #N/value within workbook. inline_strings write characters inline strings enforce enforce selected dims filled. work, dims must match x table_style table style name \"none\" (see vignette(\"openxlsx2_style_manual\")) table_name Name table workbook. table name must unique. 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. total_row logical. default FALSE total row added. start_row vector specifying starting row write x . list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. labels Method handling column labels. \"drop\" (default) \"row_before\". \"row_before\", insert column labels row column names. as_table Default FALSE. TRUE, use openxlsx2::wb_add_data_table() add data workbook. FALSE, use openxlsx2::wb_add_data(). Additional parameters ... passed one function depending value. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"","code":"wb <- wb_new_workbook(\"mtcars\") wb_add_data_ext(wb, mtcars) #> A Workbook object. #> #> Worksheets: #> Sheets: mtcars #> Write order: 1 wb_add_data_ext(wb, mtcars, as_table = TRUE) #> A Workbook object. #> #> Worksheets: #> Sheets: mtcars #> Write order: 1"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":null,"dir":"Reference","previous_headings":"","what":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"wb_add_marquee_text() uses fmt_marquee_txt() add Markdown formatted text Workbook. openxlsx2::wb_set_col_widths() applied workbook adjust widths specified columns. Set widths = NULL disable functionality.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"","code":"wb_add_marquee_text( wb = NULL, text, sheet = current_sheet(), dims = NULL, ..., cols = 1, widths = \"auto\" )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"wb Workbook object containing worksheet. text character string. core quality markdown text valid markdown restrictions content sheet worksheet write . Can worksheet index name. dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" ... Arguments passed fmt_marquee_txt style style set classic_style() defines text rendered ignore_html HTML code removed output 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.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"","code":"library(openxlsx2) wb_workbook() |> wb_add_worksheet() |> wb_add_marquee_text( text = \" # Heading 1 Example text. ~~Strikethrough text~~ ## Heading 2 - Bulleted list item 1 - Nested bullet - Bulleted list item 2\" )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new workbook and add named work sheets — wb_new_workbook","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"wb_new_workbook() convenience function wrapping openxlsx2::wb_workbook() openxlsx2::wb_add_worksheet() offer quick easy setup new workbooks.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"","code":"wb_new_workbook( sheet_names = NULL, ..., default = \"Sheet\", creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, properties = NULL )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"sheet_names Optional character vector worksheet names. ... Arguments passed openxlsx2::wb_add_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) default Default prefix use numbered sheets. Default values used sheet_names = NULL n_sheets greater length sheet_names. Defaults \"Sheet\". creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords Additional arguments passed openxlsx2::wb_workbook(). datetime_created time workbook created theme Optional theme identified string number. See Details options. properties named list (typically openxlsx2::wb_get_properties()) used set new workbook properties values set NULL. datetime_created defaults Sys.time() must set NULL inherit value properties.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"wbWorkbook object.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"","code":"wb_new_workbook() #> A Workbook object. #> #> Worksheets: #> No worksheets attached wb_new_workbook(\"Sheet 1\") #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1 #> Write order: 1 wb_new_workbook(c(\"Data\", \"Analysis\")) #> A Workbook object. #> #> Worksheets: #> Sheets: Data, Analysis #> Write order: 1, 2"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"wb_save_ext() helper function extending openxlsx2::wb_save() filling missing file name workbook title validating file extension. function stable may change future.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"","code":"wb_save_ext(wb, file = NULL, overwrite = TRUE, ...)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"wb wbWorkbook object write file file path save workbook overwrite FALSE, overwrite file already exists. ... Arguments passed openxlsx2::wb_save path Deprecated argument. Please use file new code.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"","code":"withr::with_tempdir({ wb <- wb_new_workbook( title = \"Title used for output file\", sheet_name = \"Sheet 1\" ) wb_save_ext(wb) fs::dir_ls() }) #> Title used for output file.xlsx"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":null,"dir":"Reference","previous_headings":"","what":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"wb_split() uses wb_to_df_list() extract data frames sheet workbook split ","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"","code":"wb_split(wb, ..., .key = NULL)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"... Arguments passed wb_to_df_list sheet_names Character vector sheet names. supplied, sheet names supplied workbook used. .key Passed dplyr::group_split().","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"list wbWorkbook objects.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"","code":"wb <- as_wb(list(mtcars, mtcars)) wb_split(wb, .key = carb) #> Warning: unused arguments (wb) #> Error in (function (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, check_names = FALSE, show_hyperlinks = FALSE, ...) { xlsx_file <- list(...)$xlsx_file standardize_case_names(...) if (!is.null(xlsx_file)) { .Deprecated(old = \"xlsx_file\", new = \"file\", package = \"openxlsx2\") file <- xlsx_file %||% file } if (!is.null(cols)) cols <- col2int(cols) if (inherits(file, \"wbWorkbook\")) { wb <- file } else { if (missing(sheet)) sheet <- substitute() data_only <- TRUE if (!missing(named_region) || show_hyperlinks) data_only <- FALSE wb <- wb_load(file, sheet = sheet, data_only = data_only) } if (!missing(named_region)) { nr <- wb$get_named_regions(tables = TRUE) if ((named_region %in% nr$name) && missing(sheet)) { sel <- nr[nr$name == named_region, ][1, ] sheet <- sel$sheet dims <- sel$coords } else if (named_region %in% nr$name) { sel <- nr[nr$name == named_region & nr$sheet == wb_validate_sheet(wb, sheet), ] if (NROW(sel) == 0) { stop(\"no such named_region on selected sheet\") } dims <- sel$coords } else { stop(\"no such named_region\") } } if (missing(sheet)) { sheet <- 1 } if (is.character(sheet)) { sheet <- wb_validate_sheet(wb, sheet) } if (is.null(wb$worksheets[[sheet]]$sheet_data$cc) || nrow(wb$worksheets[[sheet]]$sheet_data$cc) == 0) { message(\"sheet found, but contains no data\") return(NULL) } if (missing(named_region) && missing(dims)) { sd <- wb$worksheets[[sheet]]$sheet_data$cc[c(\"row_r\", \"c_r\")] sd$row <- as.integer(sd$row_r) sd$col <- col2int(sd$c_r) dims <- paste0(int2col(min(sd$col)), min(sd$row), \":\", int2col(max(sd$col)), max(sd$row)) } row_attr <- wb$worksheets[[sheet]]$sheet_data$row_attr cc <- wb$worksheets[[sheet]]$sheet_data$cc sst <- attr(wb$sharedStrings, \"text\") rnams <- row_attr$r numfmt_date <- numfmt_is_date(wb$styles_mgr$styles$numFmts) xlsx_date_style <- style_is_date(wb$styles_mgr$styles$cellXfs, numfmt_date) numfmt_hms <- numfmt_is_hms(wb$styles_mgr$styles$numFmts) xlsx_hms_style <- style_is_hms(wb$styles_mgr$styles$cellXfs, numfmt_hms) numfmt_posix <- numfmt_is_posix(wb$styles_mgr$styles$numFmts) xlsx_posix_style <- style_is_posix(wb$styles_mgr$styles$cellXfs, numfmt_posix) z <- dims_to_dataframe(dims, empty_rm = TRUE) tt <- copy(z) keep_cols <- colnames(z) keep_rows <- rownames(z) maxRow <- max(as.numeric(keep_rows)) maxCol <- max(col2int(keep_cols)) if (start_row > 1) { keep_rows <- as.character(seq(start_row, maxRow)) if (start_row <= maxRow) { z <- z[rownames(z) %in% keep_rows, , drop = FALSE] tt <- tt[rownames(tt) %in% keep_rows, , drop = FALSE] } else { keep_rows <- as.character(start_row) z <- z[keep_rows, , drop = FALSE] tt <- tt[keep_rows, , drop = FALSE] rownames(z) <- as.integer(keep_rows) rownames(tt) <- as.integer(keep_rows) } } if (!is.null(rows)) { keep_rows <- as.character(as.integer(rows)) if (all(keep_rows %in% rownames(z))) { z <- z[rownames(z) %in% keep_rows, , drop = FALSE] tt <- tt[rownames(tt) %in% keep_rows, , drop = FALSE] } else { z <- z[keep_rows, , drop = FALSE] tt <- tt[keep_rows, , drop = FALSE] rownames(z) <- as.integer(keep_rows) rownames(tt) <- as.integer(keep_rows) } } if (!is.null(start_col)) { keep_cols <- int2col(seq(col2int(start_col), maxCol)) if (!all(keep_cols %in% colnames(z))) { keep_col <- keep_cols[!keep_cols %in% colnames(z)] z[keep_col] <- NA_character_ tt[keep_col] <- NA_character_ z <- z[keep_cols] tt <- tt[keep_cols] } z <- z[, match(keep_cols, colnames(z)), drop = FALSE] tt <- tt[, match(keep_cols, colnames(tt)), drop = FALSE] } if (!is.null(cols)) { keep_cols <- int2col(cols) if (!all(keep_cols %in% colnames(z))) { keep_col <- keep_cols[!keep_cols %in% colnames(z)] z[keep_col] <- NA_character_ tt[keep_col] <- NA_character_ } z <- z[, match(keep_cols, colnames(z)), drop = FALSE] tt <- tt[, match(keep_cols, colnames(tt)), drop = FALSE] } keep_rows <- keep_rows[keep_rows %in% rnams] if (length(keep_rows) && length(keep_cols)) cc <- cc[cc$row_r %in% keep_rows & cc$c_r %in% keep_cols, ] cc$val <- NA_character_ cc$typ <- NA_character_ cc_tab <- unique(cc$c_t) if (any(cc_tab == \"b\")) { sel <- cc$c_t %in% \"b\" cc$val[sel] <- as.logical(as.numeric(cc$v[sel])) cc$typ[sel] <- \"b\" } if (any(cc_tab %in% c(\"str\", \"e\"))) { sel <- cc$c_t %in% c(\"str\", \"e\") cc$val[sel] <- replaceXMLEntities(cc$v[sel]) cc$typ[sel] <- \"s\" } if (any(cc_tab %in% c(\"inlineStr\"))) { sel <- cc$c_t %in% c(\"inlineStr\") cc$val[sel] <- is_to_txt(cc$is[sel]) cc$typ[sel] <- \"s\" } if (any(cc_tab %in% c(\"s\"))) { sel <- cc$c_t %in% c(\"s\") cc$val[sel] <- sst[as.numeric(cc$v[sel]) + 1] cc$typ[sel] <- \"s\" } has_na_string <- FALSE if (!all(is.na(na.strings))) { sel <- cc$val %in% na.strings if (any(sel)) { cc$val[sel] <- NA_character_ cc$typ[sel] <- \"na_string\" has_na_string <- TRUE } } has_na_number <- FALSE na.numbers <- as.character(na.numbers) if (!all(is.na(na.numbers))) { sel <- cc$v %in% na.numbers if (any(sel)) { cc$val[sel] <- NA_character_ cc$typ[sel] <- \"na_number\" has_na_number <- TRUE } } origin <- get_date_origin(wb) if (!is.null(cc$c_s)) { if (detect_dates && missing(types)) { cc$is_string <- FALSE if (!is.null(cc$c_t)) cc$is_string <- cc$c_t %in% c(\"s\", \"str\", \"b\", \"inlineStr\") if (any(sel <- cc$c_s %in% xlsx_date_style)) { sel <- sel & !cc$is_string & cc$v != \"\" cc$val[sel] <- suppressWarnings(as.character(convert_date(cc$v[sel], origin = origin))) cc$typ[sel] <- \"d\" } if (any(sel <- cc$c_s %in% xlsx_hms_style)) { sel <- sel & !cc$is_string & cc$v != \"\" if (isNamespaceLoaded(\"hms\")) { cc$val[sel] <- cc$v[sel] } else { cc$val[sel] <- suppressWarnings(as.character(convert_hms(cc$v[sel]))) } cc$typ[sel] <- \"h\" } if (any(sel <- cc$c_s %in% xlsx_posix_style)) { sel <- sel & !cc$is_string & cc$v != \"\" cc$val[sel] <- suppressWarnings(as.character(convert_datetime(cc$v[sel], origin = origin))) cc$typ[sel] <- \"p\" } } } if (any(sel <- is.na(cc$typ))) { cc$val[sel] <- cc$v[sel] cc$typ[sel] <- \"n\" } if (show_formula) { if (any(cc$f_t == \"shared\")) { cc_shared <- wb$worksheets[[sheet]]$sheet_data$cc cc_shared <- cc_shared[cc_shared$f_t == \"shared\", ] cc_shared <- cc_shared[order(as.integer(cc_shared$f_si)), ] cc_shared$f <- ave2(cc_shared$f, cc_shared$f_si, carry_forward) cc_shared$cols <- ave2(col2int(cc_shared$c_r), cc_shared$f_si, calc_distance) cc_shared$rows <- ave2(as.integer(cc_shared$row_r), cc_shared$f_si, calc_distance) cells <- find_a1_notation(cc_shared$f) repls <- vector(\"list\", length = length(cells)) for (i in seq_along(cells)) { repls[[i]] <- next_cell(cells[[i]], cc_shared$cols[i], cc_shared$rows[i]) } cc_shared$f <- replace_a1_notation(cc_shared$f, repls) cc_shared$cols <- NULL cc_shared$rows <- NULL cc_shared <- cc_shared[which(cc_shared$r %in% cc$r), ] cc[match(cc_shared$r, cc$r), ] <- cc_shared } sel <- cc$f != \"\" cc$val[sel] <- replaceXMLEntities(cc$f[sel]) cc$typ[sel] <- \"f\" } if (show_hyperlinks) { if (length(wb$worksheets[[sheet]]$hyperlinks)) { hls <- wb_to_hyperlink(wb, sheet) hyprlnks <- as.data.frame(do.call(\"rbind\", lapply(hls, function(hl) { c(hl$ref, ifelse(is.null(hl$target), hl$location, hl$target)) }))) cc$val[match(hyprlnks$V1, cc$r)] <- hyprlnks$V2 } } if (has_na_string) cc$typ[cc$typ == \"na_string\"] <- NA if (has_na_number) cc$typ[cc$typ == \"na_number\"] <- NA zz <- cc[c(\"val\", \"typ\")] zz$cols <- NA_integer_ zz$rows <- NA_integer_ zz$cols <- match(cc$c_r, colnames(z)) - 1L zz$rows <- match(cc$row_r, rownames(z)) - 1L zz <- zz[order(zz[, \"cols\"], zz[, \"rows\"]), ] if (any(zz$val == \"\", na.rm = TRUE)) zz <- zz[zz$val != \"\", ] long_to_wide(z, tt, zz) if (fill_merged_cells) { mc <- wb$worksheets[[sheet]]$mergeCells if (length(mc)) { mc <- unlist(xml_attr(mc, \"mergeCell\")) for (i in seq_along(mc)) { filler <- stringi::stri_split_fixed(mc[i], pattern = \":\")[[1]][1] dms <- dims_to_dataframe(mc[i]) if (any(row_sel <- rownames(z) %in% rownames(dms)) && any(col_sel <- colnames(z) %in% colnames(dms))) { z_fill <- wb_to_df(file = wb, sheet = sheet, dims = filler, na.strings = na.strings, convert = FALSE, col_names = FALSE, detect_dates = detect_dates, show_formula = show_formula, keep_attributes = TRUE) tt_fill <- attr(z_fill, \"tt\") z[row_sel, col_sel] <- z_fill tt[row_sel, col_sel] <- tt_fill } } } } if (skip_hidden_rows) { sel <- row_attr$hidden == \"1\" | row_attr$hidden == \"true\" if (any(sel)) { hide <- !keep_rows %in% row_attr$r[sel] z <- z[hide, , drop = FALSE] tt <- tt[hide, , drop = FALSE] } } if (skip_hidden_cols) { col_attr <- wb$worksheets[[sheet]]$unfold_cols() sel <- col_attr$hidden == \"1\" | col_attr$hidden == \"true\" if (any(sel)) { hide <- col2int(keep_cols) %in% as.integer(col_attr$min[sel]) z[hide] <- NULL tt[hide] <- NULL } } if (skip_empty_rows) { empty <- vapply(seq_len(nrow(z)), function(x) all(is.na(z[x, ])), NA) z <- z[!empty, , drop = FALSE] tt <- tt[!empty, , drop = FALSE] } if (skip_empty_cols) { empty <- vapply(z, function(x) all(is.na(x)), NA) if (any(empty)) { sel <- which(empty) z[sel] <- NULL tt[sel] <- NULL } } xlsx_cols_names <- colnames(z) names(xlsx_cols_names) <- xlsx_cols_names if (col_names) { nams <- names(xlsx_cols_names) xlsx_cols_names <- z[1, ] names(xlsx_cols_names) <- nams z <- z[-1, , drop = FALSE] tt <- tt[-1, , drop = FALSE] } if (row_names) { rownames(z) <- z[, 1] rownames(tt) <- z[, 1] xlsx_cols_names <- xlsx_cols_names[-1] z <- z[, -1, drop = FALSE] tt <- tt[, -1, drop = FALSE] } date_conv <- NULL datetime_conv <- NULL hms_conv <- convert_hms if (missing(types)) { types <- guess_col_type(tt) date_conv <- as.Date datetime_conv <- as.POSIXct } else { if (any(xlsx_cols_names %in% names(types))) { if (is.character(types)) { types[types == \"character\"] <- 0 types[types == \"numeric\"] <- 1 types[types == \"Date\"] <- 2 types[types == \"POSIXct\"] <- 3 types[types == \"logical\"] <- 4 types[types == \"hms\"] <- 5 types[types == \"formula\"] <- 6 } if (any(!names(types) %in% xlsx_cols_names)) { warning(\"variable from `types` not found in data\") types <- types[names(types) %in% xlsx_cols_names] } names(types) <- names(xlsx_cols_names[match(names(types), xlsx_cols_names)]) guess <- guess_col_type(tt) guess[names(types)] <- types types <- guess } else { stop(\"no variable from `types` found in data\") } date_conv <- convert_date datetime_conv <- convert_datetime } if (convert) { sel <- !is.na(names(types)) if (any(sel)) { nums <- names(which(types[sel] == 1)) dtes <- names(which(types[sel] == 2)) poxs <- names(which(types[sel] == 3)) logs <- names(which(types[sel] == 4)) difs <- names(which(types[sel] == 5)) fmls <- names(which(types[sel] == 6)) if (length(nums)) z[nums] <- lapply(z[nums], function(i) as.numeric(replace(i, i == \"#NUM!\", \"NaN\"))) if (length(dtes)) z[dtes] <- lapply(z[dtes], date_conv, origin = origin) if (length(poxs)) z[poxs] <- lapply(z[poxs], datetime_conv, origin = origin) if (length(logs)) z[logs] <- lapply(z[logs], as.logical) if (isNamespaceLoaded(\"hms\")) z[difs] <- lapply(z[difs], hms_conv) for (i in seq_along(z)) { if (names(z)[i] %in% fmls) class(z[[i]]) <- c(class(z[[i]]), \"formula\") } } else { warning(\"could not convert. All missing in row used for variable names\") } } if (col_names) { if (check_names) { xlsx_cols_names <- make.names(xlsx_cols_names, unique = TRUE) } names(z) <- xlsx_cols_names names(tt) <- xlsx_cols_names } if (keep_attributes) { attr(z, \"tt\") <- tt attr(z, \"types\") <- types if (!missing(named_region)) attr(z, \"dn\") <- nr } z})(wb = , sheet = \"Sheet 1\"): argument \"file\" is missing, with no default"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a workbook to a list of data frames — wb_to_df_list","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"wb_to_df_list() uses openxlsx2::wb_to_df() extract sheet workbook object data frame. Additional parameters ... recycled match length sheet names.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"","code":"wb_to_df_list(wb, sheet_names = NULL, ...)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"sheet_names Character vector sheet names. supplied, sheet names supplied workbook used. ... Arguments passed openxlsx2::wb_to_df 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.) check_names TRUE names variables data frame checked ensure syntactically valid variable names. show_hyperlinks TRUE instead displayed text, hyperlink targets shown.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"list data frame lists.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Write data to an xlsx file with additional features — write_xlsx_ext","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"write_xlsx_ext() wraps wb_add_data_ext() provide equivalent openxlsx2::write_xlsx() additional features. Arguments passed openxlsx2::wb_workbook() ignored x workbook instead data frame.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"","code":"write_xlsx_ext( x, file = NULL, ..., sheet_names = NULL, creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, as_table = FALSE, start_row = 1, geometry = c(\"drop\", \"coords\", \"wkt\"), labels = c(\"drop\", \"row_before\"), path = NULL, overwrite = TRUE, call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"x Required. wbWorkbook object, data frame, bare list data frames. x can also object coercible data frame (bare list) base::.data.frame(). x named list sheet_names supplied, existing names x ignored. file path save workbook ... additional arguments sheet_names Optional character vector worksheet names. creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords Additional workbook properties passed wb_new_workbook(). Ignored (creator title) x workbook instead data frame. datetime_created time workbook created theme Optional theme identified string number. See Details options. as_table Default FALSE. TRUE, use openxlsx2::wb_add_data_table() add data workbook. FALSE, use openxlsx2::wb_add_data(). Additional parameters ... passed one function depending value. start_row vector specifying starting row write x . geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). labels Method handling column labels. \"drop\" (default) \"row_before\". \"row_before\", insert column labels row column names. path Deprecated argument. Please use file new code. overwrite FALSE, overwrite file already exists. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"","code":"withr::with_tempdir({ # Write data frame to XLSX file write_xlsx_ext(mtcars, \"mtcars.xlsx\") # Write data frame to XLSX file with workbook title write_xlsx_ext(mtcars, title = \"mtcars data\") # Write list of data frames to XLSX file with named sheets write_xlsx_ext( list(mtcars = mtcars, anscombe = anscombe), \"datasets-list.xlsx\" ) # List output files fs::dir_ls() }) #> datasets-list.xlsx mtcars data.xlsx mtcars.xlsx"},{"path":"https://elipousson.github.io/openxlsx2Extras/news/index.html","id":"openxlsx2extras-development-version","dir":"Changelog","previous_headings":"","what":"openxlsx2Extras (development version)","title":"openxlsx2Extras (development version)","text":"Add set_sheet_list_names(), as_sheet_names(), as_sheet_list() utility functions (based existing openxlsx2 code). (2024-12-02) Add prep_wb_data() function (see #4, 2024-12-02). Add read_xlsx_ext(), write_xlsx_ext() (#3), wb_add_data_ext() functions (2024-11-10). Add set_excel_fmt_class() function. Add wb_add_marquee_text() fmt_marquee_txt() functions. Publish package GitHub (2024-10-21).","code":""}] +[{"path":"https://elipousson.github.io/openxlsx2Extras/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 openxlsx2Extras authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Eli Pousson. Author, maintainer, copyright holder.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Pousson E (2024). openxlsx2Extras: Extra Functions openxlsx2 package. R package version 0.0.0.9000, https://elipousson.github.io/openxlsx2Extras/, https://github.com/elipousson/openxlsx2Extras.","code":"@Manual{, title = {openxlsx2Extras: Extra Functions for the openxlsx2 package}, author = {Eli Pousson}, year = {2024}, note = {R package version 0.0.0.9000, https://elipousson.github.io/openxlsx2Extras/}, url = {https://github.com/elipousson/openxlsx2Extras}, }"},{"path":"https://elipousson.github.io/openxlsx2Extras/index.html","id":"openxlsx2extras","dir":"","previous_headings":"","what":"Extra Functions for the openxlsx2 package","title":"Extra Functions for the openxlsx2 package","text":"goal openxlsx2Extras extend functionality {openxlsx2} R package.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extra Functions for the openxlsx2 package","text":"can install development version openxlsx2Extras like :","code":"pak::pkg_install(\"elipousson/openxlsx2Extras\")"},{"path":"https://elipousson.github.io/openxlsx2Extras/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Extra Functions for the openxlsx2 package","text":"basic example shows use wb_save_ext() set filename based workbook title:","code":"library(openxlsx2) library(openxlsx2Extras) withr::with_tempdir({ wb_workbook( title = \"Title used for output file\" ) |> wb_add_worksheet() |> wb_save_ext() fs::dir_ls() }) #> Title used for output file.xlsx"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"as_sheet_list() prepares list data frames inclusion workbook.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"","code":"as_sheet_list( x, sheet_names = NULL, ..., n_sheets = NULL, .prep_fn = prep_wb_data, repair = \"unique\", default = \"Sheet\", call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"sheet_names One sheet names. Empty values (\"\" \" \") replaced using default parameter value position sheet_names vector. ... Arguments passed prep_wb_data x Required. data frame object coercible data frame base::.data.frame(). list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information. n_sheets Number sheet names return. .prep_fn Function use preparing list input objects. Defaults prep_wb_data(). default Default prefix use numbered sheets. Default values used sheet_names = NULL n_sheets greater length sheet_names. Defaults \"Sheet\".","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"named list data frames.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_sheet_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Prepare a data frame or list of data frames for inclusion in a workbook — as_sheet_list","text":"","code":"x <- head(mtcars, 1) y <- tail(mtcars, 1) as_sheet_list(x) #> $`Sheet 1` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> as_sheet_list(list(x, y)) #> $`Sheet 1` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> #> $`Sheet 2` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 #> as_sheet_list(list(head = x, tail = y)) #> $head #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> #> $tail #> mpg cyl disp hp drat wt qsec vs am gear carb #> Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 #> as_sheet_list(list(head = x, y)) #> $head #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 #> #> $`Sheet 2` #> mpg cyl disp hp drat wt qsec vs am gear carb #> Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 #>"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Coerce a data frame or list of data frames to a workbook — as_wb","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"as_wb() converts data frame list data frames wbWorkbook object.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"","code":"as_wb( x, ..., sheet_names = NULL, creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, properties = NULL, type = c(\"df-list\", \"df\", \"any\"), call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"x Typically, data frame list data frames. wbWorkbook returned -ignoring parameters. type = \"\", x can also object coercible data frame. ... Arguments passed wb_add_data_ext as_table Default FALSE. TRUE, use openxlsx2::wb_add_data_table() add data workbook. FALSE, use openxlsx2::wb_add_data(). Additional parameters ... passed one function depending value. labels Method handling column labels. \"drop\" (default) \"row_before\". \"row_before\", insert column labels row column names. list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. wb Workbook object containing worksheet. sheet worksheet write . Can worksheet index name. start_row vector specifying starting row write x . sheet_names Optional character vector worksheet names. creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords Additional arguments passed openxlsx2::wb_workbook(). datetime_created time workbook created theme Optional theme identified string number. See Details options. properties named list (typically openxlsx2::wb_get_properties()) used set new workbook properties values set NULL. datetime_created defaults Sys.time() must set NULL inherit value properties. type Type objects allow. \"df-list\" allows data frames lists data frames. \"df\" allows data frames . \"\" allows input (allowing option wb_add_data_ext() coerce objects data frames). call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":[]},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/as_wb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Coerce a data frame or list of data frames to a workbook — as_wb","text":"","code":"as_wb(mtcars) #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1 #> Write order: 1 as_wb(list(mtcars, mtcars)) #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":null,"dir":"Reference","previous_headings":"","what":"Format logical vector columns to use replacement values — fmt_lgl_cols","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":"fmt_lgl_cols() uses vec_fmt_lgl() format (specified) logical vector columns use replacement values.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":"","code":"fmt_lgl_cols( .data, .cols = tidyselect::where(is.logical), values = c(\"Y\", \"N\") )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). See Methods, , details. .cols Columns transform. select grouping columns already automatically handled verb (.e. summarise() mutate()). values Default c(\"Y\", \"N\") Length 2 vector first element replaces TRUE second element replaces FALSE.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_lgl_cols.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format logical vector columns to use replacement values — fmt_lgl_cols","text":"","code":"fmt_lgl_cols(data.frame(x = c(TRUE, FALSE, TRUE))) #> x #> 1 Y #> 2 N #> 3 Y"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":null,"dir":"Reference","previous_headings":"","what":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"fmt_marquee_txt() uses marquee::marquee_parse() openxlsx2::fmt_txt() format Markdown text.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"","code":"fmt_marquee_txt( text, ..., style = marquee::classic_style(), ignore_html = TRUE )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"text character string. core quality markdown text valid markdown restrictions content ... Ignored time. future use. style style set classic_style() defines text rendered ignore_html HTML code removed output","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/fmt_marquee_txt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use marquee::marquee_parse() to format Markdown text — fmt_marquee_txt","text":"","code":"fmt_marquee_txt( \"# ABC abc\" ) #> [[1]] #> fmt_txt string: #> [1] \"\" #> #> [[2]] #> fmt_txt string: #> [1] \"ABC\" #> #> [[3]] #> fmt_txt string: #> [1] \"abc\" #>"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert an object to a list of workbooks — map_wb","title":"Convert an object to a list of workbooks — map_wb","text":"map_wb() takes list returns list wbWorkbook objects.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert an object to a list of workbooks — map_wb","text":"","code":"map_wb(x, ...)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert an object to a list of workbooks — map_wb","text":"x Typically, data frame list data frames. wbWorkbook returned -ignoring parameters. type = \"\", x can also object coercible data frame. ... Arguments passed as_wb type Type objects allow. \"df-list\" allows data frames lists data frames. \"df\" allows data frames . \"\" allows input (allowing option wb_add_data_ext() coerce objects data frames). sheet_names Optional character vector worksheet names. title,subject,category,keywords Additional arguments passed openxlsx2::wb_workbook(). properties named list (typically openxlsx2::wb_get_properties()) used set new workbook properties values set NULL. datetime_created defaults Sys.time() must set NULL inherit value properties. creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. datetime_created time workbook created theme Optional theme identified string number. See Details options. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/map_wb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert an object to a list of workbooks — map_wb","text":"list wbWorkbook objects.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/openxlsx2Extras-package.html","id":null,"dir":"Reference","previous_headings":"","what":"openxlsx2Extras: Extra Functions for the openxlsx2 package — openxlsx2Extras-package","title":"openxlsx2Extras: Extra Functions for the openxlsx2 package — openxlsx2Extras-package","text":"Extends openxlsx2 package wrapper helper functions designed add new features options working Excel workbooks.","code":""},{"path":[]},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/openxlsx2Extras-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"openxlsx2Extras: Extra Functions for the openxlsx2 package — openxlsx2Extras-package","text":"Maintainer: Eli Pousson eli.pousson@gmail.com (ORCID) [copyright holder]","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Prepare data for adding to a workbook — prep_wb_data","title":"Prepare data for adding to a workbook — prep_wb_data","text":"prep_wb_data() prepares data frame addition workbook handling list columns geometry columns (sf data frames).","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare data for adding to a workbook — prep_wb_data","text":"","code":"prep_wb_data( x, list_columns = c(\"collapse\", \"drop\", \"asis\"), sep = \"; \", geometry = c(\"drop\", \"coords\", \"wkt\"), coords = c(\"lon\", \"lat\"), call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare data for adding to a workbook — prep_wb_data","text":"x Required. data frame object coercible data frame base::.data.frame(). list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/prep_wb_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Prepare data for adding to a workbook — prep_wb_data","text":"","code":"list_df <- vctrs::data_frame( num = 1, alpha = list(list(\"A\", \"B\", \"C\")) ) prep_wb_data(list_df) #> num alpha #> 1 1 A; B; C prep_wb_data(list_df, list_columns = \"drop\") #> num #> 1 1 prep_wb_data(list_df, list_columns = \"asis\") #> num alpha #> 1 1 list(\"A\", \"B\", \"C\") if (is_installed(\"sf\")) { nc <- sf::read_sf(system.file(\"shape/nc.shp\", package = \"sf\")) prep_wb_data(nc, geometry = \"coords\") prep_wb_data(nc, geometry = \"wkt\") } #> Error in is_installed(\"sf\"): could not find function \"is_installed\""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/read_xlsx_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","title":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","text":"read_xlsx_ext() uses openxlsx2::read_xlsx() allows use name repair argument (\"unique\" default) avoid blank \"\" NA values column names.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/read_xlsx_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","text":"","code":"read_xlsx_ext(file, ..., repair = \"unique\")"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/read_xlsx_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a data frame from a Workbook (with extra features) — read_xlsx_ext","text":"file xlsx file, wbWorkbook object URL xlsx file. ... Arguments passed openxlsx2::read_xlsx 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. 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. named_region Character string named_region (defined name table). sheet selected, first appearance selected. See wb_get_named_regions() check_names TRUE names variables data frame checked ensure syntactically valid variable names. show_hyperlinks TRUE instead displayed text, hyperlink targets shown. repair Either string function. string, must one \"check_unique\", \"minimal\", \"unique\", \"universal\", \"unique_quiet\", \"universal_quiet\". function, invoked vector minimal names must return minimal names, otherwise error thrown. Minimal names never NULL NA. element name, minimal name empty string. Unique names unique. suffix appended duplicate names make unique. Universal names unique syntactic, meaning can safely use names variables without causing syntax error. \"check_unique\" option perform name repair. Instead, error raised names suit \"unique\" criteria. options \"unique_quiet\" \"universal_quiet\" help user calls function indirectly, via another function exposes repair quiet. Specifying repair = \"unique_quiet\" like specifying repair = \"unique\", quiet = TRUE. \"*_quiet\" options used, setting quiet silently overridden.","code":""},{"path":[]},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_excel_fmt_class.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare a data frame with Excel style class values for formatting by openxlsx2 — set_excel_fmt_class","text":"","code":"set_excel_fmt_class(data, cols, fmt_class = \"currency\", multiple = TRUE)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_excel_fmt_class.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare a data frame with Excel style class values for formatting by openxlsx2 — set_excel_fmt_class","text":"data data frame columns format. cols Column names numbers modify. fmt_class Excel style class, one : c(\"currency\", \"accounting\", \"hyperlink\", \"percentage\", \"scientific\", \"formula\"). Length recycled match length cols using vctrs::vec_recycle(). multiple Whether arg may contain zero several values.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_excel_fmt_class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Prepare a data frame with Excel style class values for formatting by openxlsx2 — set_excel_fmt_class","text":"set_excel_fmt_class() applies style specified column. See openxlsx2 documentation information feature: https://janmarvin.github.io/openxlsx2/articles/openxlsx2_style_manual.html#numfmts2","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Set sheet names for input data — set_sheet_list_names","title":"Set sheet names for input data — set_sheet_list_names","text":"set_sheet_list_names() as_sheet_names() adapted existing functionality handling sheet names openxlsx2::write_xlsx().","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set sheet names for input data — set_sheet_list_names","text":"","code":"set_sheet_list_names( x, sheet_names = NULL, ..., n_sheets = NULL, .prep_fn = prep_wb_data, repair = \"unique\", default = \"Sheet\", call = caller_env() ) as_sheet_names( sheet_names = NULL, n_sheets = 1, default = \"Sheet\", max_length = 31, excess_length = c(\"truncate\", \"error\"), repair = \"unique\", quiet = FALSE, arg = caller_arg(sheet_names), call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Set sheet names for input data — set_sheet_list_names","text":"https://github.com/JanMarvin/openxlsx2/blob/main/R/write_xlsx.R#L281-L301","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set sheet names for input data — set_sheet_list_names","text":"sheet_names One sheet names. Empty values (\"\" \" \") replaced using default parameter value position sheet_names vector. n_sheets Number sheet names return. default Default prefix use numbered sheets. Default values used sheet_names = NULL n_sheets greater length sheet_names. Defaults \"Sheet\". max_length Maximum allowed length characters sheet names. Must 31 less. excess_length Handling sheet names exceed max_length characters. \"truncate\" trims length max_length \"error\" errors.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/set_sheet_list_names.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set sheet names for input data — set_sheet_list_names","text":"","code":"as_sheet_names() #> [1] \"Sheet 1\" as_sheet_names(\"Workbook sheet\") #> [1] \"Workbook sheet\" as_sheet_names(c(\"Workbook sheet\", \"Workbook sheet\"), quiet = TRUE) #> [1] \"Workbook sheet...1\" \"Workbook sheet...2\" as_sheet_names(\"Workbook sheet\", n_sheets = 2) #> [1] \"Workbook sheet\" \"Sheet 2\" as_sheet_names(\"Sheet names longer than 31 characters are truncated\") #> ! Truncating `\"Sheet names longer than 31 characters are truncated\"` values to #> 31 characters. #> [1] \"Sheet names longer than 31 char\""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":null,"dir":"Reference","previous_headings":"","what":"Format a logical vector to specified values — vec_fmt_lgl","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"Format logical vector specified values","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"","code":"vec_fmt_lgl(x, values = c(\"Y\", \"N\"))"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"x logical vector. values Default c(\"Y\", \"N\") Length 2 vector first element replaces TRUE second element replaces FALSE.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/vec_fmt_lgl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format a logical vector to specified values — vec_fmt_lgl","text":"","code":"vec_fmt_lgl(c(TRUE, FALSE)) #> [1] \"Y\" \"N\" vec_fmt_lgl(c(TRUE, FALSE), c(\"Yes\", \"No\")) #> [1] \"Yes\" \"No\""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"wb_add_data_ext() extends openxlsx2::wb_add_data() add data workbook special handling input data geometry list columns (using prep_wb_data()) labelled data.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"","code":"wb_add_data_ext( wb, x, sheet = current_sheet(), ..., start_row = 1, list_columns = c(\"collapse\", \"drop\", \"asis\"), sep = \"; \", geometry = c(\"drop\", \"coords\", \"wkt\"), coords = c(\"lon\", \"lat\"), labels = c(\"drop\", \"row_before\"), as_table = FALSE, call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"wb Workbook object containing worksheet. x Required. data frame object coercible data frame base::.data.frame(). sheet worksheet write . Can worksheet index name. ... Arguments passed openxlsx2::wb_add_data, openxlsx2::wb_add_data_table dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" start_col vector specifying starting column 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. apply_cell_style write cell styles workbook remove_cell_style keep cell style? na.strings Value used replacing NA values x. Default looks options(openxlsx2.na.strings) set. Otherwise na_strings() uses special #N/value within workbook. inline_strings write characters inline strings enforce enforce selected dims filled. work, dims must match x table_style table style name \"none\" (see vignette(\"openxlsx2_style_manual\")) table_name Name table workbook. table name must unique. 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. total_row logical. default FALSE total row added. start_row vector specifying starting row write x . list_columns String, one \"collapse\" (default), \"drop\", \"asis\" sep String use collapsing list columns. Ignored unless list_columns = \"collapse\". Defaults \"; \". geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). coords Length 2 character vector column names add geometry = \"coords\". Must length 2 longitude, latitude order. labels Method handling column labels. \"drop\" (default) \"row_before\". \"row_before\", insert column labels row column names. as_table Default FALSE. TRUE, use openxlsx2::wb_add_data_table() add data workbook. FALSE, use openxlsx2::wb_add_data(). Additional parameters ... passed one function depending value. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_data_ext.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add data using openxlsx2::wb_add_data() with extra features — wb_add_data_ext","text":"","code":"wb <- wb_new_workbook(\"mtcars\") wb_add_data_ext(wb, mtcars) #> A Workbook object. #> #> Worksheets: #> Sheets: mtcars #> Write order: 1 wb_add_data_ext(wb, mtcars, as_table = TRUE) #> A Workbook object. #> #> Worksheets: #> Sheets: mtcars #> Write order: 1"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":null,"dir":"Reference","previous_headings":"","what":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"wb_add_marquee_text() uses fmt_marquee_txt() add Markdown formatted text Workbook. openxlsx2::wb_set_col_widths() applied workbook adjust widths specified columns. Set widths = NULL disable functionality.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"","code":"wb_add_marquee_text( wb = NULL, text, sheet = current_sheet(), dims = NULL, ..., cols = 1, widths = \"auto\" )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"wb Workbook object containing worksheet. text character string. core quality markdown text valid markdown restrictions content sheet worksheet write . Can worksheet index name. dims Spreadsheet cell range determine start_col start_row: \"A1\", \"A1:B2\", \":B\" ... Arguments passed fmt_marquee_txt style style set classic_style() defines text rendered ignore_html HTML code removed output 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.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_add_marquee_text.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add Markdown formatted text to a Workbook — wb_add_marquee_text","text":"","code":"library(openxlsx2) wb_workbook() |> wb_add_worksheet() |> wb_add_marquee_text( text = \" # Heading 1 Example text. ~~Strikethrough text~~ ## Heading 2 - Bulleted list item 1 - Nested bullet - Bulleted list item 2\" )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new workbook and add named work sheets — wb_new_workbook","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"wb_new_workbook() convenience function wrapping openxlsx2::wb_workbook() openxlsx2::wb_add_worksheet() offer quick easy setup new workbooks.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"","code":"wb_new_workbook( sheet_names = NULL, ..., default = \"Sheet\", creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, properties = NULL )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"sheet_names Optional character vector worksheet names. ... Arguments passed openxlsx2::wb_add_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) default Default prefix use numbered sheets. Default values used sheet_names = NULL n_sheets greater length sheet_names. Defaults \"Sheet\". creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords Additional arguments passed openxlsx2::wb_workbook(). datetime_created time workbook created theme Optional theme identified string number. See Details options. properties named list (typically openxlsx2::wb_get_properties()) used set new workbook properties values set NULL. datetime_created defaults Sys.time() must set NULL inherit value properties.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"wbWorkbook object.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_new_workbook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a new workbook and add named work sheets — wb_new_workbook","text":"","code":"wb_new_workbook() #> A Workbook object. #> #> Worksheets: #> No worksheets attached wb_new_workbook(\"Sheet 1\") #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1 #> Write order: 1 wb_new_workbook(c(\"Data\", \"Analysis\")) #> A Workbook object. #> #> Worksheets: #> Sheets: Data, Analysis #> Write order: 1, 2"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"wb_save_ext() helper function extending openxlsx2::wb_save() filling missing file name workbook title validating file extension. function stable may change future.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"","code":"wb_save_ext(wb, file = NULL, overwrite = TRUE, ...)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"wb wbWorkbook object write file file path save workbook overwrite FALSE, overwrite file already exists. ... Arguments passed openxlsx2::wb_save path Deprecated argument. Please use file new code.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_save_ext.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save a workboook object to file while filling file name from assigned workbook title — wb_save_ext","text":"","code":"withr::with_tempdir({ wb <- wb_new_workbook( title = \"Title used for output file\", sheet_name = \"Sheet 1\" ) wb_save_ext(wb) fs::dir_ls() }) #> Title used for output file.xlsx"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":null,"dir":"Reference","previous_headings":"","what":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"wb_split() uses wb_to_df_list() extract data frames sheet workbook split ","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"","code":"wb_split(wb, ..., .key = NULL)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"... Arguments passed wb_to_df_list sheet_names Character vector sheet names. supplied, sheet names supplied workbook used. .key Passed dplyr::group_split().","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"list wbWorkbook objects.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_split.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use dplyr::group_split to split a workbook into a list of workbooks — wb_split","text":"","code":"wb <- as_wb(list(mtcars, mtcars)) wb_split(wb, .key = carb) #> [[1]] #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2 #> [[2]] #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2 #> [[3]] #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2 #> [[4]] #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2 #> [[5]] #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2 #> [[6]] #> A Workbook object. #> #> Worksheets: #> Sheets: Sheet 1, Sheet 2 #> Write order: 1, 2"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a workbook to a list of data frames — wb_to_df_list","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"wb_to_df_list() uses openxlsx2::wb_to_df() extract sheet workbook object data frame. Additional parameters ... recycled match length sheet names.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"","code":"wb_to_df_list(wb, sheet_names = NULL, ...)"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"sheet_names Character vector sheet names. supplied, sheet names supplied workbook used. ... Arguments passed openxlsx2::wb_to_df 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.) check_names TRUE names variables data frame checked ensure syntactically valid variable names. show_hyperlinks TRUE instead displayed text, hyperlink targets shown.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/wb_to_df_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a workbook to a list of data frames — wb_to_df_list","text":"list data frame lists.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":null,"dir":"Reference","previous_headings":"","what":"Write data to an xlsx file with additional features — write_xlsx_ext","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"write_xlsx_ext() wraps wb_add_data_ext() provide equivalent openxlsx2::write_xlsx() additional features. Arguments passed openxlsx2::wb_workbook() ignored x workbook instead data frame.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"","code":"write_xlsx_ext( x, file = NULL, ..., sheet_names = NULL, creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), theme = NULL, keywords = NULL, as_table = FALSE, start_row = 1, geometry = c(\"drop\", \"coords\", \"wkt\"), labels = c(\"drop\", \"row_before\"), path = NULL, overwrite = TRUE, call = caller_env() )"},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"x Required. wbWorkbook object, data frame, bare list data frames. x can also object coercible data frame (bare list) base::.data.frame(). x named list sheet_names supplied, existing names x ignored. file path save workbook ... additional arguments sheet_names Optional character vector worksheet names. creator Creator workbook (name). Defaults login username options(\"openxlsx2.creator\") set. title, subject, category, keywords Additional workbook properties passed wb_new_workbook(). Ignored (creator title) x workbook instead data frame. datetime_created time workbook created theme Optional theme identified string number. See Details options. as_table Default FALSE. TRUE, use openxlsx2::wb_add_data_table() add data workbook. FALSE, use openxlsx2::wb_add_data(). Additional parameters ... passed one function depending value. start_row vector specifying starting row write x . geometry String, one \"drop\" (default), \"coords\", \"wkt\". \"coords\" uses sf::st_centroid() convert input POINT geometry, transforms geometry EPSG:4326, converts geometry coordinates, adds new columns names matching coords. \"wkt\" converts geometry Well Known Text (WKT) character vector using sf::st_as_text() replaces existing geometry column (keeping existing sf column name). labels Method handling column labels. \"drop\" (default) \"row_before\". \"row_before\", insert column labels row column names. path Deprecated argument. Please use file new code. overwrite FALSE, overwrite file already exists. call execution environment currently running function, e.g. caller_env(). function mentioned error messages source error. See call argument abort() information.","code":""},{"path":"https://elipousson.github.io/openxlsx2Extras/reference/write_xlsx_ext.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write data to an xlsx file with additional features — write_xlsx_ext","text":"","code":"withr::with_tempdir({ # Write data frame to XLSX file write_xlsx_ext(mtcars, \"mtcars.xlsx\") # Write data frame to XLSX file with workbook title write_xlsx_ext(mtcars, title = \"mtcars data\") # Write list of data frames to XLSX file with named sheets write_xlsx_ext( list(mtcars = mtcars, anscombe = anscombe), \"datasets-list.xlsx\" ) # List output files fs::dir_ls() }) #> datasets-list.xlsx mtcars data.xlsx mtcars.xlsx"},{"path":"https://elipousson.github.io/openxlsx2Extras/news/index.html","id":"openxlsx2extras-development-version","dir":"Changelog","previous_headings":"","what":"openxlsx2Extras (development version)","title":"openxlsx2Extras (development version)","text":"Add set_sheet_list_names(), as_sheet_names(), as_sheet_list() utility functions (based existing openxlsx2 code). (2024-12-02) Add prep_wb_data() function (see #4, 2024-12-02). Add read_xlsx_ext(), write_xlsx_ext() (#3), wb_add_data_ext() functions (2024-11-10). Add set_excel_fmt_class() function. Add wb_add_marquee_text() fmt_marquee_txt() functions. Publish package GitHub (2024-10-21).","code":""}]