The Smart Chef

Read Excel Sheet into R

There are several reasons why it can be useful to read an Excel sheet into R:

  

library(readxl)
library(data.table)

## Read a sheet by sheet name
mydata <- read_excel("mydata.xlsx", sheet = "Sheet1")

## Read a sheet by index
mydata <- read_excel("mydata.xlsx", sheet = 1)

## This is read in as a tibble.  I'll typically convert it over to a data.table
mydata <- data.table(mydata)