Skip to content
Related Articles

Related Articles

Improve Article
How to read excel file in R ?
  • Last Updated : 26 Mar, 2021

In this article, we will be discussing two different techniques to read or import an excel file in R.

Approach

  • Import module
  • Pass path of the file to required function
  • Read file
  • Display content

Method 1: Using read_excel() from readxl

read_excel() function is basically used to import/read an excel file and it can only be accessed after importing of the readxl library in R language..

Syntax:

read_excel(path)



Example:

R




library(readxl)
  
Data_gfg <- read_excel("Data_gfg.xlsx")
  
Data_gfg

Output:

Method 2: Using read.xlsx() from xlsx

read.xlsx() function is imported from the xlsx library of R language and used to read/import an excel file in R language.

Syntax:

read.xlsx(path)

Example:

R




install.packages("xlsx")
  
Data_gfg <-read.xlsx('Data_gfg.xlsx')
  
Data_gfg

Output:

My Personal Notes arrow_drop_up
Recommended Articles
Page :