Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
690
Read the UsedRange of an Excel worksheet
posted

I'm converting a VB6 program that reads Excel files. In VB6, we used the UsedRange property of the worksheet. I don't see any equivalent property in the Infragistics Excel engine.

I've tried 2 approaches. My first attempt was to iterate through the Worksheet.Columns collection to determine the number of columns (since there's no Count property in this collection) and then use GetCellValue for each possible index value. This worked for some files, but in others it appeared that there were hundreds (or thousands) of extra columns which caused severe performance problems. My second attempt was to use the Cells collection of each row. The problem with this is that it skips empty cells in the middle of the row, so columns in the resulting rows don't align properly.

Is there any method to read the region of the worksheet that corresponds to the UsedRange in Excel?

Parents Reply Children
No Data