Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88301

How to find the exact count of sheets in all excel files

$
0
0

I want to find the count of the number of sheets in all excel files. This is what I did.

file_list <- list.files(pattern = '.xlsx',recursive = T)
head(file_list)

[1] "one.xlsx"        [2] "two.xlsx"        
[3] "three.xlsx"    [4] "four.xlsx"
[5] "five.xlsx"

So this file_list variable contains around 63 excel files.

for (num in file_list) {
   length( excel_sheets( num ) )
}

Which results in NULL result.

But when I do manually, I am getting the count. For example,

length( excel_sheets("../my_excel_directory/one.xlsx") )

[1] 2

Thanks for the help in advance!


Viewing all articles
Browse latest Browse all 88301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>