VOOZH about

URL: https://www.nuget.org/packages/MeshWeaver.DataSetReader.Excel.Utils/

⇱ NuGet Gallery | MeshWeaver.DataSetReader.Excel.Utils 2.5.0




MeshWeaver.DataSetReader.Excel.Utils 2.5.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MeshWeaver.DataSetReader.Excel.Utils --version 2.5.0
 
 
NuGet\Install-Package MeshWeaver.DataSetReader.Excel.Utils -Version 2.5.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MeshWeaver.DataSetReader.Excel.Utils" Version="2.5.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.DataSetReader.Excel.Utils" Version="2.5.0" />
 
Directory.Packages.props
<PackageReference Include="MeshWeaver.DataSetReader.Excel.Utils" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeshWeaver.DataSetReader.Excel.Utils --version 2.5.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MeshWeaver.DataSetReader.Excel.Utils, 2.5.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MeshWeaver.DataSetReader.Excel.Utils@2.5.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MeshWeaver.DataSetReader.Excel.Utils&version=2.5.0
 
Install as a Cake Addin
#tool nuget:?package=MeshWeaver.DataSetReader.Excel.Utils&version=2.5.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MeshWeaver.DataSetReader.Excel.Utils

MeshWeaver.DataSetReader.Excel.Utils is a utility library that provides common functionality and abstractions for Excel file reading in the MeshWeaver ecosystem. It serves as the foundation for both binary (.xls) and OpenXML (.xlsx) format readers.

Overview

The library provides:

  • Core interfaces for Excel data reading
  • Common utility functions for Excel data processing
  • Error handling and exception types
  • ZIP archive handling for OpenXML formats
  • Format conversion utilities
  • Data type management

Core Components

IExcelDataReader Interface

The main interface for Excel data reading implementations:

public interface IExcelDataReader : IDataReader
{
 void Initialize(Stream fileStream);
 DataSet AsDataSet();
 DataSet AsDataSet(bool convertOADateTime);
 bool IsValid { get; }
 string Name { get; }
 int ResultsCount { get; }
 bool IsFirstRowAsColumnNames { get; set; }
}

Utility Functions

Data Conversion
public static class Helpers
{
 // Convert Excel OLE Automation date to DateTime
 public static object ConvertFromOATime(double value);
 
 // Convert escaped characters in strings
 public static string ConvertEscapeChars(string input);
 
 // Convert Int64 bits to double (for binary formats)
 public static double Int64BitsToDouble(long value);
}
Data Type Management
public static class Helpers
{
 // Fix and optimize data types in DataSet
 public static void FixDataTypes(DataSet dataset);
 
 // Handle duplicate column names
 public static void AddColumnHandleDuplicate(DataTable table, string columnName);
}

ZIP Archive Handling

public class ZipWorker
{
 // Access workbook and shared strings streams
 public Stream GetWorkbookStream();
 public Stream GetSharedStringsStream();
 public Stream GetStylesStream();
}

Constants and Formats

public static class ExcelConstants
{
 // Common Excel format constants
 public const int MaxWorksheetColumns = 16384;
 public const int MaxWorksheetRows = 1048576;
 public const int MaxWorksheetNameLength = 31;
}

Error Handling

Exception Types

  • BiffRecordException - For BIFF record parsing errors
  • HeaderException - For header parsing errors
  • ExcelReaderException - Base exception for Excel reading errors

Error Messages

public static class Errors
{
 public const string InvalidPassword = "Invalid password";
 public const string InvalidFile = "Invalid file";
 public const string NotSupported = "Not supported";
}

Features

  1. Format Support

    • Binary (.xls) format utilities
    • OpenXML (.xlsx) format utilities
    • Common abstractions for both formats
  2. Data Processing

    • Stream-based reading
    • Data type inference
    • Column name handling
    • Date/time conversion
    • Character encoding support
  3. Error Handling

    • Specialized exception types
    • Validation checks
    • Error messages
    • Recovery mechanisms
  4. Performance Optimizations

    • Efficient data type handling
    • Stream management
    • Memory optimization
    • Resource cleanup

Best Practices

  1. Resource Management

    using (var stream = File.OpenRead("data.xlsx"))
    {
     var reader = new ExcelReader();
     reader.Initialize(stream);
     // Process data
    }
    
  2. Data Type Handling

    var dataset = reader.AsDataSet();
    Helpers.FixDataTypes(dataset); // Optimize data types
    
  3. Error Handling

    try
    {
     reader.Initialize(stream);
     if (!reader.IsValid)
     throw new ExcelReaderException(reader.ExceptionMessage);
    }
    catch (BiffRecordException ex)
    {
     // Handle BIFF format errors
    }
    

Integration

With Excel Readers

public class ExcelReader : IExcelDataReader
{
 protected readonly ZipWorker ZipWorker;
 
 public void Initialize(Stream stream)
 {
 ZipWorker.Initialize(stream);
 // Initialize reader
 }
}

With Message Hub

services.AddMessageHub(hub => hub
 .ConfigureServices(services => services
 .AddTransient<IExcelDataReader, ExcelReader>()
 )
);

Related Projects

  • MeshWeaver.DataSetReader.Excel - Base Excel reader framework
  • MeshWeaver.DataSetReader.Excel.BinaryFormat - Legacy Excel format implementation
  • MeshWeaver.DataSetReader.Excel.OpenXmlFormat - Modern Excel format implementation
Product Versions Compatible and additional computed target framework versions.
.NET net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on MeshWeaver.DataSetReader.Excel.Utils:

Package Downloads
MeshWeaver.DataSetReader.Excel.OpenXmlFormat

Package Description

MeshWeaver.DataSetReader.Excel.BinaryFormat

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-preview1 133 4/16/2026
2.5.0 274 11/3/2025
2.4.0 251 10/2/2025
2.3.0 294 8/4/2025
2.2.0 573 7/21/2025
2.1.0 265 4/6/2025
2.0.3 591 3/24/2025
2.0.2 559 3/24/2025
2.0.1 213 3/21/2025
2.0.0 259 3/20/2025
2.0.0-preview3 193 2/28/2025
2.0.0-Preview2 218 2/10/2025
2.0.0-preview1 199 1/6/2025
1.0.1 242 10/8/2024
1.0.0 225 10/8/2024