- Relational Operators in R
- Logical Operators in R
- Conditional Statements in R
- For Loop in R Programming
- While and Repeat Loop in R Programming
- Functions in R Programming
- Creating Functions in R
- Apply Functions in R
- Importing Data from External Data Sources in R
- Importing Data Using read.csv in R
- Import Data using read.table in R
- Importing Data Using data.table – fread in R
- Importing Data from Excel in R
- Using XLConnect in R Programming
- Importing Data from a Database in R
- SQL Queries from R
- Importing Data from Web in R

# Importing Data from Excel in R

Microsoft Excel is another tool which is commonly used for data analysis. There are many R packages that can be used to interact with Excel. Once such package is `readxl`

which was developed by Hadley Wickham.

An Excel file contains tabular data in multiple sheets. For this lesson, we have an excel sheet named `stock-prices.xlsx`

(Downloadable above) that contains stock price data for December 2016 and November 2016 in two different sheets labeled - 'Dec-2016' and 'Nov-2016'.

It is generally a good idea to first explore your data by directly opening it in MS Excel before you import it in R. Now that we know what data we are importing, let's look at how we can import it using `readxl`

.

`readxl()`

We will use two functions from `readxl`

package:

`excel_sheets()`

is used to get a list of sheets in the excel file`read_excel()`

is used to actually import the data from an excel sheet

These functions support both `.xls`

and `.xlsx`

file formats.

### Install and Load read.xl() Package

# This content is for paid members only.

Join our membership for lifelong unlimited access to all our data science learning content and resources.