Excel data reader

Buy at Amazon

Description

A software library for reading Excel data programmatically.

Supports Excel spreadsheets in Open XML format (default format since Office 2007).

Works with programming languages and environments supporting .NET

Installation

1. download REDOX.zip

2. unzip downloaded file on your computer

3. copy REDOX.dll to the root directory of your .NET project

4. in project references browse to the location of REDOX.dll and add a reference to it

Sample usage

Application app = new Application(); Workbook wb = app.OpenWorkbook(fileName); foreach (string wsName in wb.Worksheets.Keys) { Worksheet ws = wb.Worksheets[wsName]; DataTable dt = ws.GetData(true); ... [use DataTable any way you need] ... }

C# example

Object Reference

Application object
Top object in hierarchy, corresponds to Excel application
Methods:
Workbook OpenWorkbook(string FilePath)
Returns Workbook object, containing data from Excel file located in specified path

Workbook object
Analog of Excel file. Contains spreadsheet parts, collection and properties
Collections:
Dictionary<string,Worksheet> Worksheets
Contains all worksheets in workbook. Worksheet name is the key
Dictionary<string,string> SharedStrings
Collection of shared strings used in workbook. Shared String index (converted to string) is the key
Dictionary<string,string> NumberFormats
Numeric formats used in workbook (both pre-defined and custom). Format ID (converted to string) is the key
Dictionary<string,string> DateFormats
Date formats used in workbook (both pre-defined and custom). Format ID (converted to string) is the key
Dictionary<string,NumberFormatReference> NumberFormatReferences
Links to numeric formats. Format ID (converted to string) is the key
Dictionary<string,bool> IsDateFormat
Defines whether a link points to a date format. Format index (converted to string) is the key

NumberFormatReference
Object defining a link to a numeric format
Properties:
string numFmtId
Link to a numeric format
string ID
Numeric index of a reference in a reference array (converted to a string)
bool applyNumberFormat
Attribute defining the usage of a reference

Worksheet object
Contains worksheet properties and methods to extract data from worksheet XML
Methods:
DataTable GetData(bool FirstRowContainsColumnNames)
Returns DataTable, containing data from the worksheet. If FirstRowContainsColumnNames parameter is set to true, the first row of data is treated as column names.
DataTable GetData()
Override of the previous method with FirstRowContainsColumnNames defaulting to false. Returns DataTable, containing data from the worksheet. Column names in Excel cell reference format are used (A, B, C, ..., ZZ).
Properties:
string Name
Worksheet name (and caption when opened in Excel application)
string ID
Internal worksheet ID
string Dimension
Data dimensions (in Excel cell reference format)
string XML
Inner XML of worksheet
Workbook Parent
Worksheet parent workbook
XmlNodeList Rows
Collection of worksheet data rows in XML format