Skip to content

elipousson/openxlsx2Extras

Repository files navigation

openxlsx2Extras

Lifecycle: experimental License: MIT

The goal of openxlsx2Extras is to extend the functionality of the {openxlsx2} R package.

This package is very early stages so expect things to change and break as I learn more about {openxlsx2} and figure out the appropriate design for this package.

Installation

You can install the development version of openxlsx2Extras like so:

pak::pkg_install("elipousson/openxlsx2Extras")

Example

library(openxlsx2)
library(openxlsx2Extras)

As of December 2024, the main types of functions in {openxlsx2Extras} include:

  • Wrapper functions for existing {openxlsx2} functions that add some extra features, e.g. wb_save_ext() wraps openxlsx2::wb_save()
  • Convenience functions for multiple {openxlsx2} for convenience and more concise code, e.g. openxlsx2Extras::wb_new_workbook() combines openxlsx2::wb_workbook() and openxlsx2::wb_add_worksheet()
  • Other functions that support Markdown formatted text (wb_add_marquee_text()), lists of workbooks (map_wb()), lists of data frames (wb_as_df_list()), and coercion of more kinds of objects into spreadsheet-friendly formats (prep_wb_data())

For example, wb_save_ext() allows users to set a filename based on the workbook title:

wb <- wb_workbook(
  title = "Title used for output file"
)

wb <- wb$add_worksheet()

withr::with_tempdir({
  wb_save_ext(wb)
  fs::dir_ls()
})
#> Title used for output file.xlsx

wb_new_workbook() supports creating multiple worksheets in a single function call (recycling additional arguments like tab_color to match the length of sheet_names):

wb_new_workbook(
  title = "Workbook created with wb_new_workbook",
  sheet_names = c("First sheet", "Second sheet"),
  tab_color = c(wb_color("orange"), wb_color("yellow"))
)
#> A Workbook object.
#>  
#> Worksheets:
#>  Sheets: First sheet, Second sheet 
#>  Write order: 1, 2

Related Projects

Packages extending openxlsx

Packages extending openxlsx2

Packages extending readxl

  • {forgts} luisDVA/forgts}: reads a spreadsheet and its formatting information to produce gt tables with the same cell and text formatting as the input file.

Packages for working with Microsoft Office files

About

Extra Functions for the openxlsx2 package

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages