0 votes
1 view
in R Programming by (7.3k points)
edited by

How can I read an Excel file directly into R? Or should I first export the data to a text- or CSV file and import that file into R?

1 Answer

0 votes
by (25.4k points)

To read excel files directly, you can use the read_excel function from the readxl package as follows:

#read_excel reads both xls and xlsx files



# Specify sheet with a number or name

read_excel("spreadsheet1.xls", sheet = "data")

read_excel("spreadsheet1.xls", sheet = 2)

# If NAs are represented by something other than blank cells,

# set the na argument

read_excel("spreadsheet1.xls", na = "NA")

Welcome to Intellipaat Community. Get your technical queries answered by top developers !