
It can't be packaged with your application While the JET/Access driver can read Excel files as if they were databases, it has several problems, especially in the. There are some problems regarding the correct interpretation of the data types and when the length of data, present in a single excel cell, is longer than 255 characters Get Excel data in DataTable While this approach has some merits, I think you should pay particular attention to the link signaled by a comment in your question Reading excel files from C#. Of course you don't need Office installed on the target machine. There are a lot of quirks to have that driver correctly working for your application. Choose the appropriate one for the bitness of your application and what Office version is installed (if any). Pay attention to the fact that there are two versions of this component, one for 32bit and one for 64bit. However, if the file is of type xlsx (from Excel 2007 and later), then you need to download the Microsoft Access Database Engine components and install it on the target machine. This example use the .4.0 provider to open and read the Excel file. Using(OleDbDataReader dr = command.ExecuteReader())

OleDbCommand command = new OleDbCommand("select * from ", connection) Using(OleDbConnection connection = new OleDbConnection(con)) string con Source=D:\temp\test.xls " Properties='Excel 8.0 HDR=Yes '" There is the option to use OleDB and use the Excel sheets like datatables in a database. How to read data from excel file using c#
