I have a huge excel file and would like to find column "ID" for later use. Row 1 is empty, header rows is in the second.
int ID_Number = ((Range)sheet.get_Range("A2", sheet.UsedRange.Columns.Count).Find("ID Number", Missing.Value, XlFindLookIn.xlValues, XlLookAt.xlPart, XlSearchOrder.xlByColumns, XlSearchDirection.xlNext, true, Missing.Value, Missing.Value) ).Column;
int Size = ((Range)sheet.get_Range("A2", sheet.UsedRange.Columns.Count).Find("Size", Missing.Value, XlFindLookIn.xlValues, XlLookAt.xlPart, XlSearchOrder.xlByColumns, XlSearchDirection.xlNext, true, Missing.Value, Missing.Value) ).Column;
Unhandled Exception: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
Sometimes the columns order is changing in the excel and would like to handle it dinamically and not by defining column M eg for Size.