netaera.OpenXml.Excel
1.2.5
dotnet add package netaera.OpenXml.Excel --version 1.2.5
NuGet\Install-Package netaera.OpenXml.Excel -Version 1.2.5
<PackageReference Include="netaera.OpenXml.Excel" Version="1.2.5" />
<PackageVersion Include="netaera.OpenXml.Excel" Version="1.2.5" />
<PackageReference Include="netaera.OpenXml.Excel" />
paket add netaera.OpenXml.Excel --version 1.2.5
#r "nuget: netaera.OpenXml.Excel, 1.2.5"
#:package netaera.OpenXml.Excel@1.2.5
#addin nuget:?package=netaera.OpenXml.Excel&version=1.2.5
#tool nuget:?package=netaera.OpenXml.Excel&version=1.2.5
netaera.OpenXml.Excel
netaera.OpenXml.Excel is a powerful OpenXML-based library for processing Excel files in C#.
🔹 Features
- Read, write, and create Excel files using OpenXml.
- Optimized API for easy integration.
- NuGet support for quick installation in projects.
💿 Installation
Install the package via NuGet:
dotnet add package netaera.OpenXml.Excel
Or in Visual Studio:
- Open the NuGet Package Manager.
- Search for
netaera.OpenXml.Excel. - Install the package.
📖 Usage Examples
// Reads data from the first sheet in the document "data.xlsx" and
// converts the data to the data types specified in the 'ColumnInfos' configuration.
var reader = DocumentBuilder.Build(doc => doc.FileName = "data.xlsx").BuildReader();
ISheetDataRows dataRows = reader.Read(r =>
{
r.ColumnInfos
.Add("A", DataType.Integer)
.Add("B")
.Add("C", DataType.OADate) // Returns the OADate value from the Excel data.
.Add("C", DataType.DateTime)
.Add("D", DataType.Boolean)
.Add("E", DataType.Currency)
;
});
// Writes the data to columns `A`, `B`, `E`, `G`, and `I`. Column `E` contains a date, and column `I` contains a decimal currency amount.
var writer = CreatorBuilder.Build(cb => { cb.FileName = path; cb.DefaultSheetName = sheetName; })
.Create() // Erstellt eine Instanz von IDocument
.BuildWriter(wc =>
{
wc.Values = dataRows;
wc.ColumnInfos.Add("A").Add("B", DataType.Integer).Add("E", DataType.OADate).Add("G").Add("I", DataType.Currency);
});
var result = writer.Write();
if (result is false)
DebugInfo.WriteLine(writer.Messages);
// Reads all data from the first sheet in the document "data.xlsx"
var dataRows = DocumentBuilder.Build(config => config.FileName = "data.xlsx")
.BuildReader()
.Read();
// Reads all data from the worksheet named 'Data' in the file "data.xlsx", starting from cell B2
ISheetDataRows dataRows = reader.Read(r =>
{
r.SheetName = "Data";
r.FromCellAddress = "B2";
});
// Reads the first 100 cells from columns B, D, E, and F based on column names
var rows = DocumentBuilder.Build(doc => doc.FileName = "data.xlsx").BuildReader(r =>
{
r.ColumnInfos.InitializeWith (new String[] { "B", "D", "E", "F" });
r.RowCount = 100;
}).Read();
// Reads the first 100 cells for columns 1 to 8 and marks the first row as a header row
var rows = DocumentBuilder.Build(doc => doc.FileName = "data.xlsx").BuildReader(r =>
{
r.FromColumn = 1;
r.ToColumn = 8;
r.RowCount = 100;
r.FirstRowIsHeaderRow = true;
}).Read();
// Reads all cells starting from cell A2
var rows = DocumentBuilder.Build(doc => doc.FileName = "data.xlsx").BuildReader(r =>
{
r.FromCellAddress = "A2";
}).Read();
// Reads all cells within the range from B2 (top-left corner) to E22 (bottom-right corner)
var rows = DocumentBuilder.Build(doc => doc.FileName = "data.xlsx").BuildReader(r =>
{
r.FromCellAddress = "B2";
r.ToCellAddress = "E22";
}).Read();
// Provides direct access to the underlying SpreadsheetDocument
var document = DocumentBuilder.Build(doc => doc.FileName = "data.xlsx").Open();
var spreadsheet = document.SpreadsheetDocument;
⚖ License
This package can be freely used without restrictions.
However, the source code must not be copied, decompiled, modified, or published.
See LICENSE for further details.
© 2025 Paul Berthold Goebel - creativesource. All rights reserved.
| 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 is compatible. 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. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- DocumentFormat.OpenXml (>= 3.5.1)
- netaera.Common (>= 3.1.19)
-
net8.0
- DocumentFormat.OpenXml (>= 3.5.1)
- netaera.Common (>= 3.1.19)
-
net9.0
- DocumentFormat.OpenXml (>= 3.5.1)
- netaera.Common (>= 3.1.19)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on netaera.OpenXml.Excel:
| Package | Downloads |
|---|---|
|
netaera.OpenXml.Excel.SheetMapper
netaera.OpenXml.Excel.SheetMapper is a powerful extension for the netaera.OpenXml.Excel library that enables automated, attribute‑based mapping of Excel data directly to strongly‑typed DTOs. Build robust data import and transformation pipelines for business applications with support for custom type converters and complex data structures. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version 1.2.4:
- The version of the dependency `DocumentFormat.OpenXml` has been updated from `3.1.1` to `3.5.1`.
- The version of the dependency `netaera.Common` has been updated from `3.0.2` to `3.1.19`.
Version 1.2.2:
- The version of the dependency `netaera.Common` has been updated from `3.0.0` to `3.0.2`.
Version 1.2.1:
- Some minor adjustments to netaera.Common 3.0.0, netaera.OpenXml.Excel 1.2.1
Version 1.2.0:
- Added support for Excel's built-in number formats via `ExcelStandardFormat` enum
- Introduced `CustomFormat` handling for precise control over date, time, and currency formatting
- New global configuration option: `DefaultDateFormat` for consistent date output
- Improved stability in value converters, especially when reading cells with mismatched data types
- Enhanced handling of `DataType.OADate` and `DataType.DateTime` to ensure correct Excel rendering
- All format assignments now unified through consistent `StyleIndex` resolution logic
Version 1.1.4:
- Data types are now also taken into account when reading data.
– Improvements to error forwarding in 'Fluent UI Design'
– Now also available for the .NET 9 target platform.
Version 1.1.2:
- Data types can be specified for each column in the configuration.
- Data can now be written for specific columns.
- The `ColumnNames` configuration property is obsolete (will be removed in future versions); the tasks will be replaced by `ColumnInfos` property.
Version 1.1.1:
- More Base-Classes for easier (intern) handling of Excel files
Version 1.0.9:
- Corrections to row indexes
- Performance improvements
- More examples (README.md)
Version 1.0.8:
- Improvements
Version 1.0.6:
- Provides fluent API for reading, writing, and creating Excel files
Version 1.0.0:
Version 1.0.0:
- Initial release of netaera.OpenXml.Excel