I have an excel workbook which has multiple worksheets being added to it inside a loop from another workbook. I need to identify if the sheet, that is being added to new workbook from an old workbook, is empty/blank then don't add it to the new workbook. I tried using oledbadapter and read the workbook but that opens the workbook during the operation which I'm trying to read. Does anybody have any idea if I can achieve that with the help of an excel inbuilt blank check method.?

Thank you

有帮助吗?

解决方案

As far as I know there is no way to check if a sheet inside a workbook is empty or not without opening the file. You wouldn't be able to go by file size, because even a blank workbook will have header information and make the file size greater than zero. Your best bet is to use Excel interop and check the UsedRange.

Hope that helps,

Chris

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top