Virtual Mode

When reading an excel file in Virtual Mode, is there any way of knowing how many rows or cells are going to be read. I'm performing validations on some very large files, so need to read in virtual mode, but it would be nice to have a progress bar, but that obviously necessitates knowing how many rows are going to be read. At the moment, I'm reading the file whilst implementing an OnCellRead that just records the highest row value, but this still takes a few seconds, so was wondering if there's a way to get a row count without reading the entire file.

Thanks.

This currently isn't possible, but it could be implemented.

The thing is, while we can't really know the number of rows before reading all the file, Excel saves the dimensions of the sheet at the top of the file, so we could return that number to you.
The main issue with that is that the number Excel saves used to be wrong a lot of times (specially in huge files which normally are created by third parties that don't bother writing it, or updating it).

We used to use that number many years ago, but we had to stop using it because it wasn't reliable (it was one of the main causes of failures to read files at one time). So now FlexCel just ignores that number and xls.RowCount returns the actual rows in the file, which you can only know after you've read the full file.

But for virtual mode it might make sense to return that number, as you said, maybe to show a progress bar. On the other hand, it can be confusing because once we return that number people will start trusting it, and getting weird errors when it is wrong. I'll see if we can add it only for virtual mode, and still, with a name that makes it clear that it is an estimate or something. Because someone might use it to say prelocate memory or other stuff, and they will be surprised if the number is wrong.

I'll study what can be done, and let you know.

Thanks, Adrian. I'll keep using my current method for now, but I'll keep an eye on this thread.