officerExtras officerExtras website

The goal of officerExtras is to provide helper and convenience functions for the {officer} package.

Installation

You can install the development version of officerExtras like so:

# pak::pkg_install("elipousson/officerExtras")
install.packages("officerExtras", repos = c('https://elipousson.r-universe.dev', 'https://cloud.r-project.org'))

Usage

The officerExtras package provides a variety of helper functions to simplify the process of working with officer. For example, a single read_officer() function works with docx, pptx, or xlsx files:

library(officerExtras)

docx <- read_officer(
  filename = "example.docx",
  path = system.file("doc_examples", package = "officer")
)

pptx <- read_officer(
  filename = "example.pptx",
  path = system.file("doc_examples", package = "officer")
)

officer uses a print method to save rdocx, rpptx, or rxlsx objects back to files. officerExtras provides a write_officer() with that adds the option to pass a filename and path separately and pass document properties to officer::doc_properties().

withr::with_tempdir({
  write_officer(
    docx,
    "write-example.docx",
    modified_by = "officerExtras",
    title = "Document Title set by doc_properties",
    subject = "Microsoft Word, R"
  )

  example_docx <- read_officer("write-example.docx")

  officer::doc_properties(example_docx)
})
#>               tag                                value
#> 1           title Document Title set by doc_properties
#> 2         subject                    Microsoft Word, R
#> 3         creator                               author
#> 4        keywords                                     
#> 5     description                   these are comments
#> 6  lastModifiedBy                        officerExtras
#> 7        revision                                   12
#> 8         created                 2017-04-26T13:10:00Z
#> 9        modified                 2026-09-16T14:15:03Z
#> 10       category                                     
#> 11  HyperlinkBase                                     
#> 12        Company                               ArData

The package also wraps useful functions from a few other packages. convert_docx() uses rmarkdown::pandoc_convert() to convert a rdocx object or a Word document to any other pandoc supported output format:

convert_docx(docx, to = "markdown")

Related projects

There are a number of related projects for extending officer or working with OOXML in R and other languages.

Extending officer

Working with Microsoft Office documents with R

Other tools for working with Microsoft Office documents