Free Support Forum -

Column Counts

I have noticed that when I query your Columns object that in most cases it tells me that there are 256 columns in the worksheet. In the sheets that I work with most of them have no more the 15 or 20 columns. Is there a way to acurately determine how many columns there are in the worksheet?

Up until finding your product I used OleDb to open the spreadsheets. OleDb properly told me the number of columns.

Any assistance would be appreciated.


-Steven Perry
Tongue Tied

Columns collection doesn’t contains columns with default settings. To get the column count, please try to use:

int columnCount = cells.MaxColumn - cells.MinColumn;