title: How to convert all date-formatted cells in IRange to DateTime using Spreadsheet Gear C#?
body: <p>I'm trying to read the used range of an Excel file with Spreadsheet Gear and I've currently got it set up to do this:</p>
  
  <pre><code>var workbook = Factory.GetWorkbookSet().Workbooks.OpenFromStream(fileStreamInput);
  var sheet = workbook.Worksheets[0];
  var values = sheet.Cells[sheet.UsedRange.Address].Value;
  </code></pre>
  
  <p>The Excel file will be uploaded by people using different column formatting so this code needs to type-independent... except for dates. This code pulls in the double-representation of dates that Excel stores them as and I don't want that. I'm aware that the following line will convert that double into a date:</p>
  
  <pre><code>workbook.NumberToDateTime(dateAsADouble);
  </code></pre>
  
  <p>However, that assumes that I know which cell is date-formatted beforehand and I never will. I'd like to be able to convert all of the cells stored in <code>values</code> that are date-doubles using this method, ideally without looping through every value individually but I will accept such an answer if there's nothing else. I thought I might be able to use Linq but it seems that SpreadsheetGear's <code>IRange</code> class doesn't support Linq.</p>
  
  <p>Is there a way to do this? Perhaps a method that tests whether a cell is a date-double? I haven't found anything like this in SpreadsheetGear's API.</p>