OfficeIMO.CSV
0.1.0
Prefix Reserved
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package OfficeIMO.CSV --version 0.1.0
NuGet\Install-Package OfficeIMO.CSV -Version 0.1.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="OfficeIMO.CSV" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OfficeIMO.CSV" Version="0.1.0" />
<PackageReference Include="OfficeIMO.CSV" />
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 OfficeIMO.CSV --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OfficeIMO.CSV, 0.1.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 OfficeIMO.CSV@0.1.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=OfficeIMO.CSV&version=0.1.0
#tool nuget:?package=OfficeIMO.CSV&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OfficeIMO.CSV — Fluent CSV Document Model
Fluent, strongly typed, AOT-friendly CSV document model aligned with the OfficeIMO ecosystem (Word, Excel, etc.). Targets netstandard2.0, net8.0, net9.0, and net472, with streaming support for large files.
Highlights
- Document-centric API: configure delimiter, header, culture, encoding once; compose transforms fluently.
- Strong typing without reflection:
Get<T>(), helpers (AsString/AsInt32), explicit mapping builder for POCOs/records. - Schema & validation: declare columns, types, required fields, custom rules; validate or throw.
- Streaming mode: lazily enumerate huge CSVs; opt-in materialization for transforms.
- AOT friendly: no
dynamic, no codegen; trimming-safe delegates only.
Why OfficeIMO.CSV instead of hand-rolled CSV code?
- Predictable document model: headers + rows are first-class, so transforms stay consistent (no ad-hoc
List<string[]>). - Validation baked in: schemas with required/optional columns, types, defaults, custom rules; catch issues before exporting/importing downstream.
- Typed mapping without reflection: explicit column→property assignments keep AOT and trimming happy and avoid hidden reflection costs.
- Streaming + materialize on demand: handle multi-GB CSVs lazily, but flip to in-memory only when you need sorting/filtering.
- Fluent ergonomics: chainable APIs mirror other OfficeIMO packages, reducing glue code and one-off parsers.
- Cross-platform, legacy-friendly: netstandard2.0 + net472 + modern TFMs in one package.
Quick start
using OfficeIMO.CSV;
var csv = new CsvDocument()
.WithDelimiter(';')
.WithHeader("Name", "Age", "City")
.AddRow("Przemek", 36, "Mikołów")
.AddRow("Dominika", 30, "Mikołów")
.SortBy("Age")
.Filter(r => r.AsString("City") == "Mikołów")
.Save("people.csv");
Load & parse from text or file:
var doc = CsvDocument.Load("input.csv", new CsvLoadOptions { Delimiter = ';' });
// or
var doc2 = CsvDocument.Parse(csvText);
Transformations
AddRow,AddColumn(name, row => ...),RemoveColumn(name)SortBy("Age"),SortBy<TKey>(r => r.Get<int>("Age"), descending: true)Filter(r => r.AsString("City") == "Mikołów")Transform(doc => ...)for advanced scenarios
Schema & validation
var validated = CsvDocument.Load("input.csv")
.EnsureSchema(schema => schema
.Column("Id").AsInt32().Required()
.Column("Name").AsString().Required()
.Column("Age").AsInt32().Optional()
)
.ValidateOrThrow();
Retrieve errors without throwing:
validated.Validate(out var errors);
Typed mapping (no reflection)
public sealed record Person(int Id, string Name, int Age, string City);
var people = CsvDocument.Load("people.csv")
.Map<Person>(map => map
.FromColumn<int>("Id", (p, v) => p with { Id = v })
.FromColumn<string>("Name", (p, v) => p with { Name = v })
.FromColumn<int>("Age", (p, v) => p with { Age = v })
.FromColumn<string>("City", (p, v) => p with { City = v })
)
.ToList();
Streaming large files
foreach (var row in CsvDocument.Load("large.csv", new CsvLoadOptions
{
Mode = CsvLoadMode.Stream,
HasHeaderRow = true
}).AsEnumerable())
{
var id = row.AsInt32("Id");
// process lazily
}
// Need transforms? Materialize explicitly
var materialized = doc.Materialize().SortBy("Id");
Options at a glance
CsvLoadOptions:Delimiter,HasHeaderRow(default true),TrimWhitespace(default true),AllowEmptyLines,Culture,Encoding,Mode(InMemory/Stream).CsvSaveOptions:Delimiter,IncludeHeader(default true),NewLine,Culture,Encoding.
Install
dotnet add package OfficeIMO.CSV
Not seeing it on NuGet yet? During early development you can add a
ProjectReferencetoOfficeIMO.CSV.csprojin this repo.
Compatibility
- Frameworks:
netstandard2.0,net8.0,net9.0,net472. - Designed to be trimming/NativeAOT friendly on .NET 8+.
| Product | Versions 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 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. 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.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
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 |
|---|---|---|
| 0.1.0 | 527 | 12/1/2025 |