jcoliz.OpenOfficeXml.Serializer 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package jcoliz.OpenOfficeXml.Serializer --version 1.0.2
NuGet\Install-Package jcoliz.OpenOfficeXml.Serializer -Version 1.0.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="jcoliz.OpenOfficeXml.Serializer" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add jcoliz.OpenOfficeXml.Serializer --version 1.0.2
#r "nuget: jcoliz.OpenOfficeXml.Serializer, 1.0.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 jcoliz.OpenOfficeXml.Serializer as a Cake Addin
#addin nuget:?package=jcoliz.OpenOfficeXml.Serializer&version=1.0.2

// Install jcoliz.OpenOfficeXml.Serializer as a Cake Tool
#tool nuget:?package=jcoliz.OpenOfficeXml.Serializer&version=1.0.2

Office Open XML Serializer

This is a .NET Standard 2.1 library designed to make it easy to serialize C# objects from/to Office Open XML spreadsheet documents.

Background

Sometimes you just need to read and write objects to or from a spreadsheet. Perhaps you're looking for a simple library to handle all the low-level details required by the Office Open XML SDK.

Usage

Namespace

using jcoliz.OpenOfficeXml.Serializer;

Simple Serialization

void WriteToSpreadsheet<T>(Stream stream, IEnumerable<T> items) where T: class
{
    using var writer = new SpreadsheetWriter();
    writer.Open(stream);
    writer.Serialize(items);
}

Simple Deserialization

IEnumerable<T> ReadFromSpreadsheet<T>(Stream stream) where T : class, new()
{
    using var reader = new SpreadsheetReader();
    reader.Open(stream);
    return reader.Deserialize<T>();
}

Sheet Names

Select the sheet name to write into

writer.Serialize(items, "MySheet");

Discover the sheets available in a spreadsheet

foreach(var sheet in reader.SheetNames)
    Console.WriteLine(sheet);

Choose which to deserialize from

reader.Deserialize<T>("MySheet")

Exclude Properties on Deserialize

You may want to avoid reading in certain properties. For example, I typically don't want Entity Framework IDs imported from spreadsheets.

var items = reader.Deserialize<T>(exceptproperties: new string[] { "ID" });
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.3 861 8/26/2023
1.0.2 1,493 12/6/2021
1.0.1 3,472 11/25/2021
1.0.1-rc1 3,419 11/25/2021
1.0.0 886 11/21/2021
0.9.0-rc9 774 11/21/2021
0.9.0-rc7 773 11/21/2021
0.9.0-rc6 807 11/21/2021
0.9.0-rc5 763 11/21/2021
0.9.0-rc16 291 11/22/2021
0.9.0-rc15 363 11/21/2021

Fix bug #1 where exception was thrown when attempting to deserialize from a spreadsheet with multiple matching sheets.