Is it possible to extract information from an excel file in C # on a computer without excel installed?

Is it possible to extract information from an excel file (.xls) in C # on a computer without using excel ?

I have 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") exception when I try to open OleDbConnection when it starts on a computer that does not have excel installed. The same code that runs on an excel computer works fine. Therefore, I very much doubt the lack of superiority.

This is problem? If so, how can I extract data from a file?

+3
source share
3 answers

NExcel. 2 , Excel.Xlsx, Excel 07-Excel 2003.

+5

Excel

Jet, . , . - (, ..).

SpreadsheetGear.NET, , , Excel Excel . SpreadSheetGear , , .

+4

. .XLS, Microsoft Jet OLEDB 4.0 ( , 32- - 64- ) - , . , .

Check out this link, it should explain at least some of what you need to know:

Reading and writing Excel tables using ADO.NET C # DbProviderFactory

+1
source

Source: https://habr.com/ru/post/1706124/


All Articles