Home » excel » r – How to load xlsx file using fread function?

r – How to load xlsx file using fread function?

Posted by: admin March 9, 2020 Leave a comment


I wanted to use fread function to load all the datasets as I think it would better to use one type of import function so I just sticked to the fread.

Few of my files are in xlsx format and I was saving them to csv format and then using the fread function was trying to load the datasets.

But I noticed that when I converted the xlsx files into csv, an empty or incomplete row was being created in the newly created csv files.

Is there a way I can resolve this issue? Can I load xlsx file somehow using the fread function rather than converting it to csv file and then loading it using the fread function?

How to&Answers:

Here’s how: Using command line tools directly in conjunction with csvkit like this

my.dt<-fread('in2csv my.xls')