1

I have many xlsb files looks like with multiple sheets

File 1 sheet 1

NA NA NA NA
NA 3  NA NA
A  B  C  D
23 12 24 23
.......

File 1 sheet 2

NA NA NA 
NA 3  1  
NA 1  NA 
B  C  A   
23 12 21 
.....

each file has 2 sheets, some first 2-3 rows with junk, followed by column names A B C D which can be in any order or some column can be missing followed by numeric data

i want to read all xlsb in R and want to have a final output like

file1.A file1.B file1.C file1.D file2.A
43      42       23         42    43
.................................

Code tried which takes 1 hour for 1 file and read only sheet 1, however i have to start reading from a non NA row otherwise it throws an error

 rm(list=ls())
start.time = Sys.time()
library(excel.link)
setwd("C://Users//LAB//Desktop//data//")
a = dir()
df<-xl.read.file(a[1],header=TRUE, top.left.cell="A4")
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken

0 Answers0