For a solution that does not contain problematic external dependencies *, now readxl :
The readxl package makes it easy to extract data from Excel and R. Compared to many of the existing packages (for example, gdata, xlsx, xlsReadWrite), readxl has no external dependencies, so it is easy to install and use on all operating systems. It is designed to work with tabular data stored in one sheet.
Readxl supports both the legacy .xls format and the modern xml-based.xlsx..xls support for the libxls C library, which abstracts many of the complexities of the basic binary code format. To parse .xlsx, we use the RapidXML C ++ library.
It can be installed as follows:
install.packages("readxl")
or
devtools::install_github("hadley/readxl") # development version
Using
library(readxl) # read_excel reads both xls and xlsx files read_excel("my-old-spreadsheet.xls") read_excel("my-new-spreadsheet.xlsx") # 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")
* not strictly true, this requires the Rcpp package, which in turn requires Rtools (for Windows) or Xcode (for OSX), which are dependent external R. But they do not require any attempts using paths, etc. e., so that advantage over Java and Perl dependencies.
Update Now there is a rexcel package. These are promises for getting formatting, functions, and many other kinds of Excel information from an Excel file and into R.
Ben Mar 19 '15 at 7:11 2015-03-19 07:11
source share