ProjectIntroduction
Lightweight and fastOfC #Compiled libraryRead from Microsoft Excel file ('97-2007).
Cross-platform:
-Windows with. NET Framework 2
-Windows Mobile with Compact framework
-Linux, OS X, BSD with mono 2 +
How to Use
C #Code:
Filestream stream = File. Open (filepath, filemode. Open, fileaccess. Read ); // 1. reading from a binary Excel file ('97-2003 format; *. xls) Iexceldatareader excelreader = Excelreaderfactory. createbinaryreader (Stream ); // ... // 2. reading from a openxml Excel file (2007 format; *. XLSX) Iexceldatareader excelreader = Excelreaderfactory. createopenxmlreader (Stream ); // ... // 3. dataset-the result of each spreadsheet will be created in the result. Tables Dataset result = Excelreader. asdataset (); // ... // 4. dataset-create column names from first row Excelreader. isfirstrowascolumnnames = True ; Dataset result = Excelreader. asdataset (); // 5. Data reader Methods While (Excelreader. Read ()){ // Excelreader. getint32 (0 ); } // 6. free resources (iexceldatareader is idisposable) Excelreader. Close ();
VB. NET code:
Dim stream as filestream = File. Open (filepath, filemode. Open, fileaccess. Read) ' 1. reading from a binary Excel file ( ' 97 - 2003 Format ;* . Xls) dim excelreader as iexceldatareader = Excelreaderfactory. createbinaryreader (Stream) ' ... ' 2. reading from a openxml Excel file (2007 format; *. XLSX) Dim excelreader as iexceldatareader = Excelreaderfactory. createopenxmlreader (Stream) ' ... ' 3. dataset-the result of each spreadsheet will be created in the result. Tables Dim result as dataset = Excelreader. asdataset () ' ... ' 4. dataset-create column names from first row Excelreader. isfirstrowascolumnnames =Truedim result as Dataset = Excelreader. asdataset () ' 5. Data reader Methods While excelreader. Read () ' Excelreader. getint32 (0 ); End while ' 6. free resources (iexceldatareader is idisposable) Excelreader. Close ()
Attachment download: exceldatareader