Is it possible to extract information from an excel file (.xls) into c# on a computer without excel installed?
I’ve got the following code:
OleDbConnection objConn = new OleDbConnection(CONNECTION_STRING.Replace('<FILENAME>', fileName)); try { objConnection.Open(); } catch (Exception) {}
It throws an IndexOutOfRangeException (‘Cannot find table 0’) when I try to open the OleDbConnection when run on a computer that does not have excel installed. The same code run on a computer with excel works just fine. I therefore very strongly suspect the lack of excel to be the culprit.
Is this the problem? If this is, how can I extract data from the file?
Check out the open-source NExcel. Last updated about 2 years ago, so it doesn’t have support for the newer Excel 2007 .xlsx format, but will read Excel 07-Excel 2003.