Google Docs XLSX IndexOutOfRangeException

Jun 11, 2013 at 3:56 PM
Edited Jun 11, 2013 at 3:57 PM
public ActionResult Index()
            List<AirportModel> airports = new List<AirportModel>();
            var dataTable = new DataTable();
            FileStream stream = System.IO.File.Open("C:/Users/jordan.bostrom/Documents/goog.xlsx", FileMode.Open, FileAccess.Read);
            using (IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream))
                excelReader.IsFirstRowAsColumnNames = true;
                DataSet result = excelReader.AsDataSet();

                dataTable = result.Tables[0];

            using (SqlConnection connSql = new SqlConnection(ConfigurationManager.ConnectionStrings["Testing"].ConnectionString))
                using (SqlCommand cmdSql = new SqlCommand("[dbo].[Do_Stuff]", connSql))
                    cmdSql.CommandType = CommandType.StoredProcedure;
                    cmdSql.Parameters.AddWithValue("@TableInput", dataTable);
                    using (SqlDataReader reader = cmdSql.ExecuteReader())
                        while (reader.Read())
                            AirportModel airport = new AirportModel();
                            airport.IATA = reader.GetString(0);
                            airport.AirportName = reader.GetString(1);
                            airport.AirportCity = reader.GetString(2);
                            airport.Country = reader.GetString(3);
            return View(airports);
XLS and XLSX files from MS Office and LibreOffice are being read perfectly using this method, but the Google Docs format fails for some reason. I'm looking into the issue and will report back if I find anything. Is this a known issue? The error says that no table (dataTable = result.Tables[0];) has been found.
Jun 11, 2013 at 7:01 PM
I've not heard of it before. With the complexity and ambiguity of these specifications I'd imagine Google are doing the right thing and there is something subtle different.

So any test cases you can muster would be very handy.