Read Excel Files

Import excel files into R. Supports '.xls' via the embedded 'libxls' C library <> and '.xlsx' via the embedded 'RapidXML' C++ library <>. Works on Windows, Mac and Linux without external dependencies.

The readxl package makes it easy to get data out of Excel and into R. Compared to many of the existing packages (e.g. gdata, xlsx, xlsReadWrite) readxl has no external dependencies so it's easy to install and use on all operating systems. It is designed to work with tabular data stored in a single sheet.

Readxl supports both the legacy .xls format and the modern xml-based .xlsx format. .xls support is made possible the with libxls C library, which abstracts away many of the complexities of the underlying binary format. To parse .xlsx, we use the RapidXML C++ library.

You can install:

  • the latest released version from CRAN with:
  • the latest development version from github with:
# install.packages("devtools")
# read_excel reads both xls and xlsx files
# Specify sheet with a number or name
read_excel("my-spreadsheet.xls", sheet = "data")
read_excel("my-spreadsheet.xls", sheet = 2)
# If NAs are represented by something other than blank cells,
# set the na argument
read_excel("my-spreadsheet.xls", na = "NA")
  • Re-encodes non-ASCII characters to UTF-8.

  • Loads datetimes into POSIXct columns. Both Windows (1900) and Mac (1904) date specifications are processed correctly.

  • Blank columns and rows are automatically dropped.

  • It returns data frames with additional tbl_df class, so if you have dplyr loaded, you get nicer printing.

The package includes an example file created with openxlsx:

l <- list("iris" = iris, "mtcars" = mtcars, chickwts = chickwts, quakes = quakes)
openxlsx::write.xlsx(l, file = "inst/extdata/datasets.xlsx")


readxl 0.1.1

  • Add support for correctly reading strings in .xlsx files containing escaped unicode characters (e.g. _x005F_) (#51, thanks to @jmarshallnz).

Reference manual

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


1.0.0 by Jennifer Bryan, 9 months ago,

Report a bug at

Browse source code at

Authors: Hadley Wickham [aut], Jennifer Bryan [aut, cre], RStudio [cph] (Copyright holder of all R code and all C/C++ code without explicit copyright attribution), Marcin Kalicinski [ctb, cph] (Author of included RapidXML code), Komarov Valery [ctb, cph] (Author of included libxls code), Christophe Leitienne [ctb, cph] (Author of included libxls code), Bob Colbert [ctb, cph] (Author of included libxls code), David Hoerl [ctb, cph] (Author of included libxls code)

Documentation:   PDF Manual  

GPL-3 license

Imports cellranger, Rcpp, tibble

Suggests covr, knitr, rmarkdown, rprojroot, testthat

Linking to Rcpp

Imported by BAYESDEF, BEACH, CONS, DCM, DLMtool, GWSDAT, GerminaR, GetTDData, Luminescence, NPMOD, PNADcIBGE, QuantTools, RDML, RLumShiny, RcmdrMisc, SchemaOnRead, TR8, breathtestcore, chillR, crosswalkr, dpcR, elementR, evaluator, ggplotgui, googlePublicData, ie2misc, joinXL, lessR, memapp, photobiologyInOut, popprxl, readtext, rio, shinyHeatmaply, textreadr, tidyverse, visvow, xlutils3, zooaRchGUI.

Depended on by DataLoader.

Suggested by PCRedux, Rcmdr, RcmdrPlugin.EZR, ckanr, descriptr, dynBiplotGUI, ezec, heemod, inferr, manifestoR, olsrr, rattle, raw, rotl, secr, syuzhet, tidyxl, unvotes, writexl.

See at CRAN