How do i know if a excel sheet is empty?

Hi guys, im currently stuck in trying to read if the excel sheets are empty a not. My project needs to read every sheet which i did already but how do i read all of them to find the empty sheets?
I have tried using IsNullOrEmpty or IsNullOrWhitespace but still dont read them

Hi after for each put read range and pass the row in sheet name and store it in a datatable, after that put a condition if dtTable isnot nothing (dtTable is the datatable and this method used to check if the datatable is not nothing)

hai what do you mean by pass the row in sheet name n store in datatable.
I so far followed your steps until here

In sheet name give row.tostring,

And wb.getsheets in foreach is used to loop through the sheets right?

yepp thats rite

Ok then try giving the row.tostring in sheet name and let me know… thanks

hmmm im not sure if it actually works but it was able to copy/paste for one of the companies and look thru but remember i put a message box in the else condition? It didnt show up i was testing if it works first.

Is any of the sheet is empty?if yes please share the excel.

Yes there is a few empty sheets
License List.xlsx (70.8 KB)

Before read range activity in assign give dt to nothing… because sometimes after first loop the previous data still present.


Check below for your reference

Hope this may help you


1 Like

omg thanks this works for me :))

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.