Importing Excel data using R: Step by Step

Update: Please refer to this blog for various other ways to import excel as the steps outlined by me has dependency on Perl.

In this blog I’m going to share with you the steps involved in importing the data and understanding its aspects from R.


  1. Windows XP
  2. Completed the installation of R (In this example I’m using R version 2.15.2)

Step 1: Keep the Excel ready with you, in this example I’ve prepared my own sample data which is the table which captures of the various employees who have shown interest for stream change. The column labeled “Agreed” captures whether they are agreed or not. Snapshot of the worksheet:

Step 2: I have named the file as datasource.xls

Step 3: For using the Excel we will need the “gdata” package. If we have not installed it we can do it by using the command install.packages(“gdata”). Make sure you have internet connection to download the package.

Step 4: Then issue the command library(gdata), which will enable support for using .xls files in “R”

Step 5: We are going to use the command read.xls. If you need more or additional help regarding the same you can issue help (read.xls) which will start the server and load its relevant content.

Step 6: I have saved the datasource.xls in mydocuments folder

Step 7: Issue the command mydata=read.xls(“datasource.xls”) and again type mydata to see the excel file loaded to the R environment. If the file is missing or there is problem in the path you will get an error.

Step 8: In this final step we can see the summary of data using the command Summary(mydata)