Exporting 'flextable' to 'xlsx' Files

Exports 'flextable' objects to 'xlsx' files, utilizing functionalities provided by 'flextable' and 'openxlsx2'.


flexlsx

Lifecycle:experimental Codecov testcoverage R-CMD-check

The primary objective of flexlsx is to offer an effortless interface for exporting flextable objects directly to Microsoft Excel. Building upon the robust foundation provided by openxlsx2 and flextable, flexlsx ensures compatibility, precision, and efficiency when working with both trivial and complex tables.

Installation

You can install the development version of flexlsx like so:

# install.packages("remotes")
remotes::install_github("pteridin/flexlsx")

Or install the CRAN release like so:

install.packages("flexlsx")

Example

This is a basic example which shows you how to solve a common problem:

library(flexlsx)

# Create a flextable and an openxlsx2 workbook
ft <- flextable::as_flextable(table(mtcars[,1:2]))
wb <- openxlsx2::wb_workbook()$add_worksheet("mtcars")

# add the flextable ft to the workbook, sheet "mtcars"
# offset the table to cell 'C2'
wb <- wb_add_flextable(wb, "mtcars", ft, dims = "C2")

# save the workbook to a temporary xlsx file
tmpfile <- tempfile(fileext = ".xlsx")
wb$save(tmpfile)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("flexlsx")

1.0.0 by Tobias Heidler, 8 months ago


https://github.com/pteridin/flexlsx


Report a bug at https://github.com/pteridin/flexlsx/issues


Browse source code at https://github.com/cran/flexlsx


Authors: Tobias Heidler [aut, cre, cph] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports dplyr, grDevices, openxlsx2, purrr, Rcpp, rlang, stringi, tibble, tidyr

Suggests covr, gtsummary, flextable, testthat, officer

Linking to Rcpp


Suggested by bsitar.


See at CRAN