You will have to append your file consistency check with the following logicas steps:
1. Open the created excel file
2. Check if sheet, with the specific name, exists.
if it exists, then:
2.1 Check the columns (more precise it would be to say cells) for what data type they are.
Here is an example you can use:
private void Excel_Inspector(string Path_to_your_selected_file)
{
try{
Microsoft.Office.Interop.Excel.Application Excel_App = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook Excel_Wbk = Excel_App.Workbooks.Open(Path_to_your_selected_file);
Excel_App.Visible = true;
int sheet_number = Excel_Wbk.Sheets.Count;
while (sheet_number >= 1)
{
if (Excel_Wbk.Sheets[sheet_number].Name == "DATA")
{
string Number_Format = Excel_App.Range["A1"].NumberFormat.ToString();
MessageBox.Show(Number_Format);
}
sheet_number--;
}
Excel_Wbk.Close(false);
Excel_App.Workbooks.Close();
Excel_App.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(Excel_Wbk);
System.Runtime.InteropServices.Marshal.ReleaseComObject(Excel_App);
}catch (Exception ex)
{MessageBox.Show(ex.Message); }
Hope this puts you on the track.
Good luck!
Modestas