Excel - Finding data rows count




I am reading an empty excel from a share point and finding its row count (dataTable1.rows.Count). It is returning the value 1.

When I try the same with the excel in local drive, it is returning the value 0.

Have you guys came across this type of scenario. Why there is a difference in the output.

  1. are you sure the excel is actually empty? if i’m not mistaking, the “read range” will read the equivalent of “used range” in vba. meaning that a cell format, font change etc. might trick the app into thinking that cell has a value
  2. there are some strange behaviors in sharepoint - i had some troubles in the past with the sharepoint modifying the files and inserting some data (probably used for some internal content indexing?). not sure if there is a resolution for this.

eventually you can check what the datatable actually contains in that row…


Yes. I created an excel and didn’t even open it. I kept it with the default name and used Read range activity. Even then the output is 1.