ExcelReader Class |
Namespace: Accord.IO
The ExcelReader type exposes the following members.
Name | Description | |
---|---|---|
ExcelReader(String) |
Creates a new spreadsheet reader.
| |
ExcelReader(Stream, Boolean) |
Creates a new spreadsheet reader.
| |
ExcelReader(String, Boolean) |
Creates a new spreadsheet reader.
| |
ExcelReader(Stream, Boolean, Boolean) |
Creates a new spreadsheet reader.
| |
ExcelReader(String, Boolean, Boolean) |
Creates a new spreadsheet reader.
| |
ExcelReader(Stream, Boolean, Boolean, Boolean) |
Creates a new spreadsheet reader.
|
Name | Description | |
---|---|---|
HasHeaders |
Gets whether the workbook has column headers.
| |
HasMixedData |
Gets whether the data contains mixed string and numeric data.
| |
Provider |
Gets the data provider used by the reader.
| |
Version |
Gets the Excel version used by the reader.
| |
WorksheetNames |
Gets the names of the distinct sheets
that are contained in the Excel file.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetColumnsList |
Gets the list of columns in a worksheet.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetWorksheet |
Gets the entire worksheet as a data set.
| |
GetWorksheet(Int32) |
Gets an worksheet as a data table.
| |
GetWorksheet(String) |
Gets an worksheet as a data table.
| |
GetWorksheetList |
Gets the list of worksheets in the spreadsheet.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
This class requires the Microsoft Access Database Engine to work. The download is available from Microsoft under the name "Microsoft Access Database Engine 2010 Redistributable", available in both 32-bit (x86) and 64-bit (x64) versions.
By default, the redistributable package will only install if it is the same as the current version of Microsoft Office installed in the machine (i.e. ACE 32-bit can not be installed with 64-bit office and vice-versa). To overcome this limitation and install both versions of the ACE drivers, specify /passive as a command line argument when installing the packages.
// Create a new reader, opening a given path ExcelReader reader = new ExcelReader(path); // Afterwards, we can query the file for all // worksheets within the specified workbook: string[] sheets = reader.GetWorksheetList(); // Finally, we can request an specific sheet: DataTable table = reader.GetWorksheet(sheets[1]); // Now, we have loaded the Excel file into a DataTable. We // can go further and transform it into a matrix to start // running other algorithms on it: double[,] matrix = table.ToMatrix(); // We can also do it retrieving the name for each column: string[] columnNames; matrix = table.ToMatrix(out columnNames); // Or we can extract specific columns into single arrays: double[] column = table.Columns[0].ToArray(); // PS: you might need to import the Accord.Math namespace in // order to be able to call the ToMatrix extension methods.