GetValue() returns a value from the current row as an object, or null if there is no value.IsDBNull() checks if a value in the current row is null.Always one of the types supported by Excel: double, int, bool, DateTime, TimeSpan, string, or null if there is no value. GetFieldType() returns the type of a value in the current row.GetColumnWidth() returns the width of a column in character units.RowHeight returns the visual height of the current row in points.MergeCells returns an array of merged cell ranges in the current sheet.HeaderFooter returns an object with information about the headers and footers, or null if there are none.
Throws InvalidOperationException on CSV files when used with AnalyzeInitialCsvRows. This includes terminal empty rows which are otherwise excluded by AsDataSet().
IExcelDataReader extends the and IDataRecord interfaces to navigate and retrieve data at a lower level. The AsDataSet() extension method is a convenient helper for quickly getting the data, but is not always available or desirable to use. This caller is responsible for interpreting the CSV data. The reader returns all CSV field values as strings and makes no attempts to convert the data to numbers or dates. Throws if the input cannot be parsed with the specified encoding. The input CSV is always parsed once completely to set FieldCount, RowCount, Encoding, Separator (or twice if the CSV lacks BOM and is not UTF8), and then parsed once again while iterating the row records. See also the configuration options FallbackEncoding and AutodetectSeparators. Use ExcelReaderFactory.CreateCsvReader instead of CreateReader to parse a stream of plain text with comma separated values. The result of each spreadsheet is in result.Tables Use the AsDataSet extension method var result = reader.
Auto-detect format, supports: // - Binary Excel files (2.0-2003 format *.xls) // - OpenXml Excel files (2007 format *.xlsx, *.xlsb) using ( var reader = ExcelReaderFactory. Compatible with net20, net45 and netstandard2.0.
Install the ExcelDataReader.DataSet extension package to use the AsDataSet() method to populate a. Compatible with net20, net45, netstandard1.3 and netstandard2.0. Install the ExcelDataReader base package to use the "low level" reader interface. It is recommended to use NuGet through the VS Package Manager Console Install-Package or using the VS "Manage NuGet Packages." extension.Īs of ExcelDataReader version 3.0, the project was split into multiple packages: Supported file formats and versions File Type If you are reporting an issue it is really useful if you can supply an example Excel file as this makes debugging much easier and without it we may not be able to resolve any problems.
Please feel free to fork and submit pull requests to the develop branch. Lightweight and fast library written in C# for reading Microsoft Excel files (2.0-2007).