Klyroo.Spreadsheet.Core
0.1.0-preview.2
dotnet add package Klyroo.Spreadsheet.Core --version 0.1.0-preview.2
NuGet\Install-Package Klyroo.Spreadsheet.Core -Version 0.1.0-preview.2
<PackageReference Include="Klyroo.Spreadsheet.Core" Version="0.1.0-preview.2" />
<PackageVersion Include="Klyroo.Spreadsheet.Core" Version="0.1.0-preview.2" />
<PackageReference Include="Klyroo.Spreadsheet.Core" />
paket add Klyroo.Spreadsheet.Core --version 0.1.0-preview.2
#r "nuget: Klyroo.Spreadsheet.Core, 0.1.0-preview.2"
#:package Klyroo.Spreadsheet.Core@0.1.0-preview.2
#addin nuget:?package=Klyroo.Spreadsheet.Core&version=0.1.0-preview.2&prerelease
#tool nuget:?package=Klyroo.Spreadsheet.Core&version=0.1.0-preview.2&prerelease
Klyroo.Spreadsheet
A .NET library that imports CSV, TSV, Excel (.xlsx and .xls) and pasted spreadsheet data into your application, with column mapping, value mapping and row validation, for developers who build onboarding and bulk-edit screens.
User files rarely match your model: the header is on row 3, a column is named differently, a status says "Gold" where you expect "pro". Klyroo.Spreadsheet puts the engine that deals with this in a headless package you can unit test, and adds a Blazor wizard on top of it. The engine runs anywhere .NET 11 runs, and the wizard runs in Blazor Web Apps and .NET MAUI Blazor Hybrid.
Features
- Header and sheet detection: scans the first 20 rows of a sheet and picks the row where most schema columns match, so title rows above the header are skipped.
- Forgiving column matching: compares headers ignoring case, accents, extra spaces, a trailing
*and a trailing(required), against the column key, its label and any aliases you list. - Column suggestions: when a required column has no match, proposes an unused file column if at least 80% of up to 30 sampled cells parse and pass the rules, and applies it only when you call
AssignColumn. - Typed parsing and rules: text, number (either decimal mark), date, boolean and select columns, with built-in
Email,Pattern,Min,MaxandBetweenrules, custom rules and a cross-fieldValidateRowcallback. - Unknown value questions: turns select cells that match no option into questions you answer by mapping, leaving empty, skipping the rows or creating the value, or resolves them automatically with a per-column policy.
- Duplicates and existing records: detects repeated keys inside the file, keeps the first or last, and marks rows whose key already exists as updates, skips or errors.
- Inline correction: edits cells, discards and restores rows, filters the review by tab, severity, issue and text, all without touching the source file.
- 12 languages: the wizard, its validation messages and its screen reader announcements follow the Klyroo.UI locale (English and French reviewed, ten drafts), and any text can be changed per locale.
- Large files: parses a file once and then updates only the rows a change concerns, so editing a cell of a 50,000-row file takes milliseconds, and the wizard pages its review table and caps an import at 10,000 rows by default.
- Saved mappings: stores the column mapping and value answers of an import as JSON (source-generated, AOT-safe) and applies them automatically to the next file with the same headers.
- Batched submit with retry: sends importable rows to your callback in batches, shows the rows the server refused as errors on those rows, and sends only them again.
Packages
| Package | Description |
|---|---|
Klyroo.Spreadsheet.Core |
The import engine: parsing, matching, validation and submit. No UI dependency. |
Klyroo.Spreadsheet |
The KlySpreadsheetImport wizard for Blazor and .NET MAUI Blazor Hybrid, built on Klyroo.UI. Includes the Core package. |
For native .NET MAUI apps without a BlazorWebView, the repository also includes Klyroo.Spreadsheet.Maui (built from source over Klyroo.Spreadsheet.Core and Klyroo.UI.Maui).
Prerequisites
To use the library in an app:
- The .NET 11 SDK, and an app that targets
net11.0. The packages are prereleases, so everydotnet add packagecommand needs--prerelease. Klyroo.Spreadsheet.Corealone (the importer and the.xlsxreader) runs in any .NET 11 app, with no other dependency.- A Blazor app for
Klyroo.Spreadsheet: a Blazor Web App or a .NET MAUI Blazor Hybrid app. The wizard, including the file picker, needs an interactive render mode (Interactive Server, WebAssembly or Auto). In a WebAssembly or Auto app, register the services in the server project and in the.Clientproject. - Klyroo.UI set up in the app.
Klyroo.Spreadsheetbrings the Klyroo.UI package, andAddKlyrooSpreadsheet()registers its services, but the layout still needs the Klyroo.UI stylesheets in<head>and<KlyApp>around the body, as described in the Klyroo.UI installation. - A browser with the native popover API, which Klyroo.UI uses: Chrome and Edge 114, Safari 17 or Firefox 125, or later. In a .NET MAUI app, that means iOS or Mac Catalyst 17, or an Android System WebView 114 or later.
- Network access on the first build only if your app self-hosts web fonts (
KlyrooFont), uses icons outside the built-in set, or compiles Tailwind (KlyrooTailwind): the build downloads them once and caches them underobj/klyroo. Node.js is not needed.
To build this repository you need the .NET 11 SDK (a newer SDK works too, see global.json) and a clone of klyroo-ui in the same parent folder: some projects reference it by relative path (../klyroo-ui/...). See Contributing.
Installation
dotnet add package Klyroo.Spreadsheet.Core --prerelease # engine only
dotnet add package Klyroo.Spreadsheet --prerelease # engine and Blazor wizard
For the Blazor wizard, register the services in Program.cs (or MauiProgram.cs), import the namespace in _Imports.razor, and load the stylesheets after the ones of Klyroo.UI:
using Klyroo.Spreadsheet;
builder.Services.AddKlyrooSpreadsheet();
@using Klyroo.Spreadsheet
<link rel="stylesheet" href="_content/Klyroo.UI/klyroo.preflight.css" />
<link rel="stylesheet" href="_content/Klyroo.UI/klyroo.css" />
<link rel="stylesheet" href="_content/Klyroo.Spreadsheet/klyroo-spreadsheet.css" />
Quick start
Headless, with Klyroo.Spreadsheet.Core:
using Klyroo.Spreadsheet;
var schema = SpreadsheetSchema.For<PriceRow>(s =>
{
s.Column(r => r.Sku, c => c.Label("SKU").Required());
s.Column(r => r.Price, c => c.Label("Unit price").DecimalSeparator(',').Required().Rule(SpreadsheetRule.Min(0m)));
s.Column(r => r.Currency, c => c.Options(
[
new SpreadsheetOption<Currency>(Currency.Eur, "Euro", ["€"]),
new SpreadsheetOption<Currency>(Currency.Usd, "US dollar", ["$"]),
]));
s.OnSubmit = rows =>
{
foreach (var row in rows)
{
Console.WriteLine($"{row.Value.Sku}: {row.Value.Price} {row.Value.Currency}");
}
return Task.FromResult<IReadOnlyList<SpreadsheetRejectedRow>?>(null);
};
});
var importer = new SpreadsheetImporter<PriceRow>(schema);
importer.LoadText("SKU;Unit price;Currency\nA-1;12,50;€\nA-2;-3;USD", "prices.csv");
Console.WriteLine(importer.ImportableRows.Count); // 1
Console.WriteLine(importer.InvalidRows.Count); // 1: A-2 has a negative price
await importer.SubmitAsync();
public enum Currency { Eur, Usd }
public sealed class PriceRow
{
public string? Sku { get; set; }
public decimal Price { get; set; }
public Currency Currency { get; set; }
}
The schema is typed by a row class. Each column is a property picked with a member expression, and its kind follows the property type: text for string, a number for int, decimal and the other numeric types, yes or no for bool, a date for DateOnly, DateTime and DateTimeOffset, and a choice for an enum or for any column with Options. A property that cannot hold an empty cell (decimal, bool, an enum) is required, so use decimal? when the cell may stay empty. The callbacks receive SpreadsheetRow<PriceRow>, which carries the parsed row in Value.
In Blazor, give the same importer to KlySpreadsheetImport. Users choose or drop a CSV, TSV or .xlsx file on its first step, or paste rows copied from a spreadsheet:
@page "/prices/import"
@using Klyroo.Spreadsheet
<KlySpreadsheetImport Importer="_importer" Title="Import prices" />
@code {
private SpreadsheetImporter<PriceRow> _importer = default!;
protected override void OnInitialized()
{
_importer = new SpreadsheetImporter<PriceRow>(SpreadsheetSchema.For<PriceRow>(s =>
{
s.Column(r => r.Sku, c => c.Label("SKU").Required());
s.Column(r => r.Price, c => c.Required());
s.OnSubmit = SaveAsync;
}));
}
private Task<IReadOnlyList<SpreadsheetRejectedRow>?> SaveAsync(IReadOnlyList<SpreadsheetRow<PriceRow>> rows)
{
// Persist rows.Select(r => r.Value) here. Return the rows the server refused, or null.
return Task.FromResult<IReadOnlyList<SpreadsheetRejectedRow>?>(null);
}
}
KlySpreadsheetImport takes the non-generic SpreadsheetImporter, because it reads and edits cells as text and never touches your row type, so a SpreadsheetImporter<PriceRow> is passed as it is.
Documentation
| Getting started | Step-by-step first integration |
| Guides | Task-oriented recipes |
| Concepts | How the library works |
| Platforms | Render modes, .NET MAUI, NativeAOT |
| API reference | Every public type and member |
| FAQ | Troubleshooting and limitations |
Compatibility
- .NET 11 SDK.
Klyroo.Spreadsheet.Coretargetsnet11.0, has no package dependencies and is markedIsTrimmableandIsAotCompatible.Klyroo.Spreadsheetneeds an interactive render mode (Interactive Server, WebAssembly or Auto): the component handles events through Blazor, so under Static SSR it renders but does not respond.Klyroo.Spreadsheetdeclares thebrowser,ios,android,maccatalystandwindowsplatforms for .NET MAUI Blazor Hybrid.- Delimited text (CSV, TSV, semicolon-separated),
.xlsxworkbooks and legacy.xlsworkbooks (Excel 97 to 2003) are read. Formulas are not evaluated, and password-protected or Excel 5.0/95.xlsfiles are refused.
Klyroo ecosystem
Klyroo is a family of independent .NET libraries that compose. Each one has its own repository, versions and releases.
| Library | Description |
|---|---|
| Klyroo.UI | Accessible Blazor components for the web and .NET MAUI Blazor Hybrid, styled with Tailwind CSS v4 |
| Klyroo.Query | Typed query model, URL state sync, and IQueryable / EF Core execution |
| Klyroo.Table | Data lists with table and card-grid layouts, filters, selection and actions |
| Klyroo.Form | Schema-driven forms, validation and wizards |
| Klyroo.Dashboard | Dashboard controller, filters and Blazor blocks: stats, gauges, charts, tables and feeds |
| Klyroo.Display | Code highlighting, secret and file list components, media player controls and file preview |
| Klyroo.Spreadsheet | Import wizard for CSV, TSV, Excel and pasted data, with column and value mapping |
| Klyroo.Agent | Bridge that lets AI agents read and act on Klyroo forms, dashboards and imports |
| Klyroo.Hotkey | Server-side .NET client for Hotkey cloud browsers, human handoffs and signed webhooks |
| Klyroo.Stack | Meta-package, MCP documentation server and dotnet new templates |
Contributing
Contributions are welcome. Read CONTRIBUTING.md before opening a pull request, and follow the code of conduct. Report security issues privately as described in SECURITY.md.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net11.0 is compatible. |
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
-
net11.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Klyroo.Spreadsheet.Core:
| Package | Downloads |
|---|---|
|
Klyroo.Stack.Core
Klyroo Core Meta-Package: aggregates all headless, NativeAOT-compatible Core engines of Klyroo (Query, Table, Form, Dashboard, Display, Spreadsheet, Agent) and the KlyrooStackCatalog router. |
|
|
Klyroo.Agent
Klyroo Semantic Agent Bridge for Blazor Web & .NET MAUI Hybrid: connects Klyroo.Form, Klyroo.Dashboard, and Klyroo.Spreadsheet to AI agents and WebMCP. |
|
|
Klyroo.Spreadsheet
Klyroo Spreadsheet Import wizard, column/value mapping, inline review table and row inspector for Blazor Web & .NET MAUI Hybrid. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.2 | 43 | 11/29/2026 |
| 0.1.0-preview.1 | 43 | 11/29/2026 |