title: Finding table boundaries in Excel using C#
body: <p>I am trying to create a program in C# that reads in an Excel file, stores the information in memory, and then have the ability to perform calculations on that information.</p>
  
  <p>Right now, I'm able to read in the information though I'm hard-coding how many rows and columns exist.  The problem is that I may get an Excel sheet that consists of a 2 by 2 table and another Excel sheet that is a 500 by 300 table.  I'm trying to create a method that will find out what the table's boundaries are by finding the first NULL cell in the "date" column and the header column.</p>
  
  <p>I found a bit of code that looks like Convert.ToString((object)dateCol) == "" to try and find the first NULL cell.  Unfortunately (in an if statement) that bit of code seems to be targeting all the cells whether they are NULL or not.  Same problem occurs if I try to do a straight comparison (if (dateCol == null)).</p>
  
  <p>Thanks,
  Jesse</p>