The The R Primer logo Primer

Read data from an Excel, OpenOffice, or LibreOffice spreadsheet

You want to import a dataset stored as a Microsoft Excel, OpenOffice Calc, or LibreOffice Calc file

Solution:

The easiest way to read data from a spreadsheet into R is to export the spreadsheet to a delimited file like a comma-separated file and then import the CSV file as described in Rule 1.5.

Alternatively, for Microsoft Excel files it is also possible to use the RODBC or xlsx packages to import data directly into R. See rules 1.6, 1.7, 1.8, and 1.9 in The R Primer for more information.

Back to tips.