I having issues with Object reference not set to an instance of an object

Developer
Dec 3, 2011 at 12:50 AM
Edited Dec 3, 2011 at 1:09 AM

I new to the project but I have a spreadsheet that causes exception {"Object reference not set to an instance of an object."}

the spreadsheet 54 columns in it but it looks like _cellsValue[i] is null for some reason, this issue is not a duplicate column name.

 if (!_isFirstRowAsColumnNames)
                {
                    for (int i = 0; i < _workbook.Sheets[_resultIndex].ColumnsCount; i++)
                    {
                        try
                        {
                               table.Columns.Add(_cellsValues[i].ToString());

 at Excel.ExcelOpenXmlReader.AsDataSet(Boolean convertOADateTime) in ExcelDataReader\ExcelOpenXmlReader.cs:line 297

 

looks like I had the setting excelReaderOpenXml.IsFirstRowAsColumnNames = false;