Webwonders.SpreadsheetHandler
14.1.2
dotnet add package Webwonders.SpreadsheetHandler --version 14.1.2
NuGet\Install-Package Webwonders.SpreadsheetHandler -Version 14.1.2
<PackageReference Include="Webwonders.SpreadsheetHandler" Version="14.1.2" />
paket add Webwonders.SpreadsheetHandler --version 14.1.2
#r "nuget: Webwonders.SpreadsheetHandler, 14.1.2"
// 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
- Fork the repository.
- Create a new branch.
- Commit your changes.
- Push the branch.
- Create a Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Product | Versions 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. |
-
net8.0
- NPOI (>= 2.7.1)
- Umbraco.Cms.Web.Website (>= 13.0.0 && < 15.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.