Package: openxlsx2 1.28

Jan Marvin Garbuszus

openxlsx2: Read, Write and Edit 'xlsx' Files

Simplifies the creation of 'xlsx' files by providing a high level interface to writing, styling and editing worksheets.

Authors:Jordan Mark Barbone [aut], Jan Marvin Garbuszus [aut, cre], Olivier Roy [ctb], openxlsx authors [cph], Arseny Kapoulkine [ctb, cph]

openxlsx2_1.28.tar.gz
openxlsx2_1.28.tar.gz(r-4.7-arm64)openxlsx2_1.28.tar.gz(r-4.7-x86_64)openxlsx2_1.28.tar.gz(r-4.6-arm64)openxlsx2_1.28.tar.gz(r-4.6-x86_64)
openxlsx2_1.28.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
openxlsx2/json (API)

# Install 'openxlsx2' in R:
install.packages('openxlsx2', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/janmarvin/openxlsx2/issues

Pkgdown/docs site:https://janmarvin.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

9.54 score 25 packages 698 scripts 14k downloads 167 exports 3 dependencies

Last updated from:8412b40140. Checks:6 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64OK259
linux-devel-x86_64OK261
source / vignettesOK315
linux-release-arm64OK260
linux-release-x86_64OK284
wasm-releaseOK187

Exports:apply_numfmtas_xmlcol2intconvert_dateconvert_datetimeconvert_hmsconvert_to_excel_dateconvertToExcelDatecreate_bordercreate_cell_stylecreate_colors_xmlcreate_colours_xmlcreate_commentcreate_dxfs_stylecreate_fillcreate_fontcreate_hyperlinkcreate_numfmtcreate_pivottablestylecreate_shapecreate_sparklinescreate_tablestylecurrent_sheetdataframe_to_dimsdelete_datadims_to_dataframedims_to_rowcolfmt_txtint2colna_stringsnext_sheetread_xlsxread_xmlremove_commentrowcol_to_dimsstyles_on_sheettemp_xlsxvalidate_dimswb_add_borderwb_add_cell_stylewb_add_chart_xmlwb_add_chartsheetwb_add_commentwb_add_conditional_formattingwb_add_creatorswb_add_datawb_add_data_tablewb_add_data_validationwb_add_drawingwb_add_dxfs_stylewb_add_encharterwb_add_fillwb_add_filterwb_add_fontwb_add_form_controlwb_add_formulawb_add_hyperlinkwb_add_ignore_errorwb_add_imagewb_add_mipswb_add_mschartwb_add_named_regionwb_add_named_stylewb_add_numfmtwb_add_page_breakwb_add_personwb_add_pivot_tablewb_add_plotwb_add_slicerwb_add_sparklineswb_add_stylewb_add_threadwb_add_timelinewb_add_worksheetwb_clean_sheetwb_clone_sheet_stylewb_clone_worksheetwb_colorwb_colourwb_commentwb_copy_cellswb_datawb_dimswb_freeze_panewb_get_active_sheetwb_get_base_colorswb_get_base_colourswb_get_base_fontwb_get_bookviewwb_get_cell_stylewb_get_commentwb_get_creatorswb_get_mipswb_get_named_regionswb_get_orderwb_get_personwb_get_propertieswb_get_selectedwb_get_sheet_nameswb_get_sheet_visibilitywb_get_tableswb_get_threadwb_grid_lineswb_group_colswb_group_rowswb_loadwb_merge_cellswb_openwb_page_setupwb_protectwb_protect_worksheetwb_readwb_remove_bookviewwb_remove_col_widthswb_remove_commentwb_remove_conditional_formattingwb_remove_creatorswb_remove_filterwb_remove_hyperlinkwb_remove_named_regionwb_remove_row_heightswb_remove_slicerwb_remove_tableswb_remove_timelinewb_remove_worksheetwb_savewb_set_active_sheetwb_set_base_colorswb_set_base_colourswb_set_base_fontwb_set_bookviewwb_set_cell_stylewb_set_cell_style_acrosswb_set_col_widthswb_set_creatorswb_set_grid_lineswb_set_header_footerwb_set_last_modified_bywb_set_orderwb_set_page_setupwb_set_propertieswb_set_row_heightswb_set_selectedwb_set_sheet_nameswb_set_sheet_visibilitywb_set_sheetviewwb_to_dfwb_ungroup_colswb_ungroup_rowswb_unmerge_cellswb_update_tablewb_workbookwbWorkbookwrite_commentwrite_datawrite_datatablewrite_formulawrite_xlsxxl_openxml_add_childxml_attrxml_attr_modxml_nodexml_node_createxml_node_namexml_rm_childxml_value

Dependencies:R6Rcppstringi

Add charts to a workbook
Add plot to workbook | Add {ggplot2} plot to workbook | Add plot via | Adding {encharter} plots | Add and fill a chartsheet | Add {mschart} plots

Last update: 2026-07-02
Started: 2022-12-18

openxlsx2 basic manual
First steps | Handling workbooks | Importing as workbook | Exporting data | Exporting data frames or vectors | Exporting a wbWorkbook | dims/ wb_dims() | A note on speed and memory usage

Last update: 2026-07-02
Started: 2023-08-07

Add styling to a workbook
Styling showcase | Colors, text rotation and number formats | the quick way: using high-level functions | the long way: using bare-metal functions | Working with number formats | numfmts | numfmts2 | Modifying the column widths | wb_set_col_widths | Adding borders | add borders | styled table | the long way: creating everything from the bone | Use workbook colors and modify them | Copy cell styles | Style strings | Create custom table styles

Last update: 2026-02-21
Started: 2022-09-30

openxlsx2 read to data frame
Importing data | Basic import | col_names - first row as column name | detect_dates - convert cells to R dates | show_formula - show formulas instead of results | dims - read specific dimension | cols - read selected columns | rows - read selected rows | convert - convert input to guessed type | skip_empty_rows - remove empty rows | skip_empty_cols - remove empty columns | row_names - keep rownames from input | types - convert column to specific type | start_row - where to begin | na - define missing values

Last update: 2026-02-21
Started: 2024-06-03

Add conditional formatting to a workbook
Rule applies to all each cell in range | Highlight row dependent on first cell in row | Highlight column dependent on first cell in column | Highlight cell dependent on | Highlight entire range cols X rows dependent only on cell A1 | Highlight cells in column 1 based on value in column 2 | Highlight duplicates using default style | Cells containing text | Cells not containing text | Cells begins with text | Cells ends with text | Colorscale colors cells based on cell value | Databars | Between | Top N | Bottom N | Logical Operators

Last update: 2025-12-07
Started: 2022-09-30

Upgrade from openxlsx
Basic read and write functions | Read xlsx or xlsm files | Write xlsx files | Basic workbook functions | Loading a workbook | Styles | Conditional formatting | Data validation | Saving | Why openxlsx2? | Invitation to contribute

Last update: 2025-12-07
Started: 2022-09-30

Add formulas to a workbook
Simple formulas | Array formulas | Array formulas creating multiple fields | cells metadata (cm) formulas | dataTable formulas^[this example was originally provided by @zykezero for openxlsx.] | dataTable formula differences

Last update: 2025-02-15
Started: 2023-05-26

Readme and manuals

Help Manual

Help pageTopics
Modify the state of active and selected sheets in a workbookactive_sheet-wb wb_get_active_sheet wb_get_selected wb_set_active_sheet wb_set_selected
Format Values using OOXML (Spreadsheet) Number Format Codesapply_numfmt
loads character string to pugixml and returns an externalptras_xml
as.character pugi_xmlas.character.pugi_xml
Set the default font in a workbookbase_font-wb wb_get_base_font wb_set_base_font
Clean worksheet nameclean_worksheet_name
Modify column widths of a worksheetcol_widths-wb wb_remove_col_widths wb_set_col_widths
Convert spreadsheet column notation to integerscol2int
Convert from spreadsheet date, datetime or hms number to R Date typeconvert_date convert_datetime convert_hms
convert back to an Excel Dateconvert_to_excel_date
Create border formatcreate_border
Create cell stylecreate_cell_style
Create custom color xml schemescreate_colors_xml create_colours_xml
Create a custom formatting stylecreate_dxfs_style
Create fill patterncreate_fill
Create font formatcreate_font
Create spreadsheet hyperlink stringcreate_hyperlink
Create number formatcreate_numfmt
Helper to create a shapecreate_shape
Create a sparklines objectcreate_sparklines
Create custom (pivot) table stylescreate_pivottablestyle create_tablestyle
Modify creators of a workbookcreators-wb wb_add_creators wb_get_creators wb_remove_creators wb_set_creators
Helper functions to work with 'dims'dims_helper dims_to_rowcol rowcol_to_dims validate_dims
Add/remove column filters in a worksheetfilter-wb wb_add_filter wb_remove_filter
format strings independent of the cell style.+.fmt_txt as.character.fmt_txt fmt_txt print.fmt_txt
Group rows and columns in a worksheetgrouping-wb wb_group_cols wb_group_rows wb_ungroup_cols wb_ungroup_rows
Convert integers to spreadsheet column notationint2col
Modify named regions in a worksheetnamed_region-wb wb_add_named_region wb_get_named_regions wb_remove_named_region
Options consulted by openxlsx2openxlsx2_options
Deprecated functions in package _openxlsx2_openxlsx2-deprecated
Helper for adding threaded commentsperson-wb wb_add_person wb_get_person
print pugi_xmlprint.pugi_xml
Modify workbook propertiesproperties-wb wb_get_properties wb_set_properties
xml_nodepugixml xml_attr xml_node xml_node_name xml_value
read xml fileread_xml
Modify row heights of a worksheetrow_heights-wb wb_remove_row_heights wb_set_row_heights
Get / Set worksheet names for a workbooksheet_names-wb wb_get_sheet_names wb_set_sheet_names
Get/set worksheet visible state in a workbooksheet_visibility-wb wb_get_sheet_visibility wb_set_sheet_visibility
Get all styles on a sheetstyles_on_sheet
helper function to create temporary directory for testing purposetemp_xlsx
'openxlsx2' waiverscurrent_sheet na_strings next_sheet waivers
Modify borders in a cell region of a worksheetwb_add_border
Modify the style in a cell regionwb_add_cell_style
Add a chart XML to a worksheetwb_add_chart_xml
Add a chartsheet to a workbookwb_add_chartsheet
Add comment to worksheetwb_add_comment wb_get_comment wb_remove_comment
Add conditional formatting to cells in a worksheetwb_add_conditional_formatting wb_remove_conditional_formatting
Add data to a worksheetwb_add_data
Add a data table to a worksheetwb_add_data_table
Add data validation to cells in a worksheetwb_add_data_validation
Add drawings to a worksheetwb_add_drawing
Set a dxfs style for the workbookwb_add_dxfs_style
Add a Chart object to a workbook sheetwb_add_encharter
Modify the background fill color in a cell regionwb_add_fill
Modify font properties in a cell regionwb_add_font
Add a checkbox, radio button or drop menu to a cell in a worksheetwb_add_form_control
Add a formula to a cell range in a worksheetwb_add_formula
wb_add_hyperlinkwb_add_hyperlink wb_remove_hyperlink
Ignore error types on a worksheetwb_add_ignore_error
Insert an image into a worksheetwb_add_image
wb get and apply MIP sectionwb_add_mips wb_get_mips
Add an mschart object to a worksheetwb_add_mschart
Apply styling to a cell region with a named stylewb_add_named_style
Modify number formatting in a cell regionwb_add_numfmt
Add a page break to a worksheetwb_add_page_break
Add a pivot table to a worksheetwb_add_pivot_table
Insert the current R plot into a worksheetwb_add_plot
Add a slicer/timeline to a pivot tablewb_add_slicer wb_add_timeline wb_remove_slicer wb_remove_timeline
Add sparklines to a worksheetwb_add_sparklines
Register a style in a workbookwb_add_style
Add threaded comments to a cell in a worksheetwb_add_thread wb_get_thread
Add a worksheet to a workbookwb_add_worksheet
Set the default colors in a workbookwb_base_colors wb_get_base_colors wb_get_base_colours wb_set_base_colors wb_set_base_colours
Get or set cell style indiceswb_cell_style wb_get_cell_style wb_set_cell_style wb_set_cell_style_across
Clear content and formatting from a worksheetwb_clean_sheet
Apply styling from a sheet to another within a workbookwb_clone_sheet_style
Create copies of a worksheet within a workbookwb_clone_worksheet
Create a color object for workbook stylingwb_color wb_colour
Helper to create a comment objectwb_comment
Copy cells around within a worksheetwb_copy_cells
Add the 'wb_data' attribute to a data frame in a worksheetwb_data [.wb_data
Helper to specify the 'dims' argumentwb_dims
Freeze panes of a worksheetwb_freeze_pane
List tables in a worksheetwb_get_tables
Load an existing .xlsx, .xlsm or .xlsb filewb_load
Merge cells within a worksheetwb_merge_cells wb_unmerge_cells
Preview a workbook in spreadsheet softwarewb_open
Order worksheets in a workbookwb_get_order wb_order wb_set_order
Set page margins, orientation and print scaling of a worksheetwb_page_setup wb_set_page_setup
Protect a workbook from modificationswb_protect
Protect a worksheet from modificationswb_protect_worksheet
Remove a data table from a worksheetwb_remove_tables
Remove a worksheet from a workbookwb_remove_worksheet
Save a workbook to filewb_save
Get and Set the workbook position, size and filterwb_get_bookview wb_remove_bookview wb_set_bookview
Modify grid lines visibility in a worksheetwb_grid_lines wb_set_grid_lines
Set headers and footers of a worksheetwb_set_header_footer
Modify author in the metadata of a workbookwb_set_last_modified_by
Modify the default view of a worksheetwb_set_sheetview
Create a data frame from a Workbookread_xlsx wb_read wb_to_df
Update a data table position in a worksheetwb_update_table
Create a new Workbook objectwb_workbook
Workbook classwbWorkbook
Write data to an xlsx filewrite_xlsx
Open a file or workbook object in spreadsheet softwarexl_open xl_open.default xl_open.wbWorkbook
append xml child to nodexml_add_child
adds or updates attribute(s) in existing xml nodexml_attr_mod
create xml_node from R objectsxml_node_create
remove xml child to nodexml_rm_child