Learn R Programming

⚠️There's a newer version (4.2.8) of this package.Take me there.

openxlsx

This R package simplifies the creation of .xlsx files by providing a high level interface to writing, styling and editing worksheets. Through the use of Rcpp, read/write times are comparable to the xlsx and XLConnect packages with the added benefit of removing the dependency on Java.

Installation

The openxlsx package requires a zip application to be available to R, such as the one that comes with Rtools, available here. (Windows only)

If the command

shell("zip")

returns

'zip' is not recognized as an internal or external command, operable program or
batch file.

or similar. Then;

the system PATH during installation.

  • If Rtools is installed, add the Rtools bin directory paths (default installation paths are

c:\Rtools\bin and c:\Rtools\gcc-4.6.3\bin) to the system PATH variable.

Stable version

Current stable version is available on CRAN via

install.packages("openxlsx", dependencies=TRUE)

Development version

Development version can be installed via GitHub once Rtools (Windows only) has been setup with:

install.packages(c("Rcpp", "devtools"), dependencies=TRUE)
require(devtools)
install_github("awalker89/openxlsx")

Bug/feature request

Please let me know which version of openxlsx you are using when posting bug reports.

packageVersion("openxlsx")

Thanks, here.

News

Here.

Authors and Contributors

A list is automagically maintained here.

Copy Link

Version

Install

install.packages('openxlsx')

Monthly Downloads

351,987

Version

4.0.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Alexander Walker

Last Published

January 9th, 2017

Functions in openxlsx (4.0.0)

addFilter

Add column filters
addStyle

Add a style to a set of cells
copyWorkbook

Copy a Workbook object.
convertToDate

Convert from excel date number to R Date type
convertToDateTime

Convert from excel time number to R POSIXct type.
convertFromExcelRef

Convert excel column name to integer index
all.equal

Check equality of workbooks
addWorksheet

Add a worksheet to a workbook
conditionalFormat

Add conditional formatting to cells
conditionalFormatting

Add conditional formatting to cells
createStyle

Create a cell style
dataValidation

Add data validation to cells
createWorkbook

Create a new Workbook object
createNamedRegion

Create a named region.
getBaseFont

Return the workbook default font
freezePane

Freeze a worksheet pane
createComment

create a Comment object
deleteData

Delete cell data
getCellRefs

Return excel cell coordinates from (x,y) coordinates
getDateOrigin

Get the date origin an xlsx file is using
insertPlot

Insert the current plot into a worksheet
removeCellMerge

Create a new Workbook object
int2col

Convert integer to Excel column
readWorkbook

Read from an Excel file or Workbook object
saveWorkbook

save Workbook to file
writeData

Write an object to a worksheet
replaceStyle

Replace an existing cell style
mergeCells

Merge cells within a worksheet
modifyBaseFont

Modify the default font
removeColWidths

Remove column widths from a worksheet
removeComment

Remove a comment from a cell
removeRowHeights

Remove custom row heights from a worksheet
removeFilter

Remove a worksheet filter
setColWidths

Set worksheet column widths
insertImage

Insert an image into a worksheet
getStyles

Returns a list of all styles in the workbook
getNamedRegions

Get named regions
setFooter

Set footer for all worksheets
getSheetNames

Get names of worksheets
writeDataTable

Write to a worksheet as an Excel table
names

get or set worksheet names
openXL

Open a Microsoft Excel file (xls/xlsx) or an openxlsx Workbook
removeWorksheet

Remove a worksheet from a workbook
renameWorksheet

Rename a worksheet
writeFormula

Write a character vector as an Excel Formula
sheetVisible

Get worksheet visible state.
sheetVisibility

Get/set worksheet visible state
openxlsx

xlsx reading, writing and editing.
pageBreak

add a page break to a worksheet
setHeader

Set header for all worksheets
setHeaderFooter

Set document headers and footers
makeHyperlinkString

create Excel hyperlink string
loadWorkbook

Load an exisiting .xlsx file
worksheetOrder

Order of worksheets in xlsx file
showGridLines

Set worksheet gridlines to show or hide.
read.xlsx

Read from an Excel file or Workbook object
pageSetup

Set page margins, orientation and print scaling
writeComment

write a cell comment
write.xlsx

write data to an xlsx file
setRowHeights

Set worksheet row heights
sheets

Returns names of worksheets.