Webwonders.SpreadsheetHandler 14.1.2

dotnet add package Webwonders.SpreadsheetHandler --version 14.1.2                
NuGet\Install-Package Webwonders.SpreadsheetHandler -Version 14.1.2                
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="Webwonders.SpreadsheetHandler" Version="14.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Webwonders.SpreadsheetHandler --version 14.1.2                
#r "nuget: Webwonders.SpreadsheetHandler, 14.1.2"                
#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.
// Install Webwonders.SpreadsheetHandler as a Cake Addin
#addin nuget:?package=Webwonders.SpreadsheetHandler&version=14.1.2

// Install Webwonders.SpreadsheetHandler as a Cake Tool
#tool nuget:?package=Webwonders.SpreadsheetHandler&version=14.1.2                

Webwonders.SpreadsheetHandler

Webwonders.SpreadsheetHandler is a .NET library for reading and writing spreadsheets using datatables or custom classes. It provides an injectable IWebwondersSpreadsheetHandler service with methods for mapping spreadsheets to classes, handling multiple sheets, and managing errors. Attributes define spreadsheet settings and column mappings, supporting repeated columns. The library returns spreadsheets as MemoryStream objects for easy file handling.


Features

  • Read spreadsheets into DataTables or custom classes
  • Write DataTables to spreadsheets
  • Attribute-based column mapping
  • Supports multiple sheets and repeated columns
  • Injectable service for easy integration

Installation

Use NuGet to install:

Install-Package Webwonders.SpreadsheetHandler

Usage

Dependency Injection Setup

services.AddTransient<IWebwondersSpreadsheetHandler, WebwondersSpreadsheetHandler>();

Reading a Spreadsheet

using (var stream = new FileStream("file.xlsx", FileMode.Open))
{
    var result = _spreadsheetHandler.ReadSpreadsheet<MyClass>(stream);
}

Writing a Spreadsheet

var dataTable = new DataTable();
// Populate DataTable
var stream = _spreadsheetHandler.WriteSpreadsheet(dataTable);
File.WriteAllBytes("output.xlsx", stream.ToArray());

Defining Attributes in a Model Class

[SpreadsheetSheet(Name = "Sheet1")]
public class MyClass
{
    [SpreadsheetColumn(Name = "ID")]
    public int Id { get; set; }

    [SpreadsheetColumn(Name = "Name")]
    public string Name { get; set; }
}

Contributing

  1. Fork the repository.
  2. Create a new branch.
  3. Commit your changes.
  4. Push the branch.
  5. Create a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


GitHub Repository

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
14.1.2 36 2/18/2025
14.0.2 118 12/3/2024
14.0.0 100 11/7/2024
13.0.6 89 11/7/2024
13.0.3 94 11/5/2024
13.0.2 98 11/5/2024
13.0.0 95 11/5/2024