You have already established that there is a NumberFormat property and you know how to set it to a date, so instead of just setting it compare it against that format.
There is a worked example here
C# : How to identify the cell format is Number or currency ot accounting or percentage in excel using Interop[
^]
Unfortunately the link in the solution is broken, but I think this article will provide any extra information you need
Excel custom number formats | Exceljet[
^]
Alternatively you could format a variety of columns with the different formats you might come across and use the following to work out what the format strings look like (untested):
foreach (Microsoft.Office.Interop.Excel.Range col in worksheet.Columns)
{
Debug.Print(col.NumberFormat);
}
As an aside, it is not good practice to use a variable name of
row
to hold a column as in
foreach (Microsoft.Office.Interop.Excel.Range row in worksheet.Columns)
and there is no point in using a foreach if you are going to explicitly reference a single column as in
worksheet.Columns[3].NumberFormat = "dd/MM/yyyy";
See my code above for a better way of doing this