Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read xlsx file using data.table::fread(), but selecting the sheet

Tags:

r

data.table

I'm not founding any argument in the fread() function to let me select the sheet I want.
I'm trying this:

tab <- data.table::fread('myfile.xlsx')

As my file has many sheets, how can I select just one of them by sheet name?

like image 201
igorkf Avatar asked Oct 15 '25 13:10

igorkf


1 Answers

 library("readxl")
 FirstTable  <- read_excel("locations.xlsx", 1) # for first tab
 SecondTable <- read_excel("locations.xlsx", 4) # for fourth tab

An alternative way!

You may find this link useful - importing excel to r

like image 108
bp41 Avatar answered Oct 17 '25 15:10

bp41