I am using the Excel Data Reader plugin to read and parse excel data, and I would like to set the "IsFirstRowAsColumnNames" to true then finding out that there is no such definition for my created IExcelDataReader object. See the "XXXXXXXXXX" from below code. I want to set my first row as column name. Now I am having "Column1", "Column 2," ......"Column n" instead.
public DataTable ExcelDataTable(string filename) { FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read); IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlRead(stream); excelReader.XXXXXXXXXXXX= true; DataSet result = excelReader.AsDataSet(); DataTableCollection table = result.Tables; DataTable resultTable = table["Person"]; return resultTable; }
Thanks for your help