The readxl package has the function
read_excel() for reading .xls and .xlsx files from Excel. This will read the first sheet of an Excel spreadsheet:
read_excel(), you can load from other sheets by specifying a number for sheetIndex or a name for sheetName:
read_excel() uses the first row of the spreadsheet for column names. If you don’t want to use that row for column names, use
col_names = FALSE. The columns will instead be named
X2, and so on.
read_excel() will infer the type of each column, but if you want to specify the type of each column, you can use the
col_types argument. You can also drop columns if you specify the type as
?read_excel for more options controlling the reading of these files.
There are other packages for reading Excel files. The gdata package has a function
read.xls() for reading in .xls files, and the xlsx package has a function
read.xlsx() for reading in .xlsx files. They require external software to be installed on your computer:
read.xls() requires Java, and
read.xlsx() requires Perl.