How do we check if a column exists in an excel sheet ?
I used read range to read data from an excel sheet and use a loop to read data on every excel sheet. But I want to check if a column exist in an excel sheet. Any idea guys?
I tried dt.Columns.Contains(“columnname”) but it does not work
Hello @Jelrey try getting column name like below:
String.Join("-,-",(from col in dt.Columns.Cast(of DataColumn) select x = col.ColumnName))
and then check if your desired column exist or not and if exist then what is the column name.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.