PandaTech.FluentImporter
5.0.0
dotnet add package PandaTech.FluentImporter --version 5.0.0
NuGet\Install-Package PandaTech.FluentImporter -Version 5.0.0
<PackageReference Include="PandaTech.FluentImporter" Version="5.0.0" />
<PackageVersion Include="PandaTech.FluentImporter" Version="5.0.0" />
<PackageReference Include="PandaTech.FluentImporter" />
paket add PandaTech.FluentImporter --version 5.0.0
#r "nuget: PandaTech.FluentImporter, 5.0.0"
#:package PandaTech.FluentImporter@5.0.0
#addin nuget:?package=PandaTech.FluentImporter&version=5.0.0
#tool nuget:?package=PandaTech.FluentImporter&version=5.0.0
Pandatech.FluentImporter
Fluent API for importing CSV and Excel data into .NET 8+ applications with customizable property mapping and validation.
Installation
dotnet add package PandaTech.FluentImporter
Quick Start
Define Your Model
public class FileData
{
public long Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public DateTime Date { get; set; }
public string? Comment { get; set; }
public DateTime CreatedAt { get; init; }
public string CreatedBy { get; init; }
}
Create Import Rules
public class FileDataImportRule : ImportRule<FileData>
{
public FileDataImportRule()
{
RuleFor(x => x.Name)
.NotEmpty();
RuleFor(x => x.Description)
.ReadFromColumn("Description text")
.Default("No Description");
RuleFor(x => x.Date)
.ReadFromColumn("Date")
.Convert(DateTime.Parse);
RuleFor(x => x.Comment)
.ReadFromColumn("Comment");
RuleFor(x => x.Id)
.ReadFromColumn("Id")
.Convert(s => long.Parse(s));
RuleFor(x => x.CreatedAt)
.WriteValue(DateTime.UtcNow);
RuleFor(x => x.CreatedBy)
.ReadFromModel(x => x.CreatedBy + " - Modified");
}
}
Import Data
var importRule = new FileDataImportRule();
// From CSV file
var data = importRule.ReadCsv("path/to/file.csv");
// From CSV stream
using var stream = File.OpenRead("file.csv");
var data = importRule.ReadCsv(stream);
// From Excel file
var data = importRule.ReadXlsx("path/to/file.xlsx");
// From Excel stream
using var stream = File.OpenRead("file.xlsx");
var data = importRule.ReadXlsx(stream);
// From in-memory data
var dict = new List<Dictionary<string, string>>
{
new() { ["Name"] = "John", ["Date"] = "2024-01-01" }
};
var data = importRule.GetRecords(dict);
API Reference
Property Rules
| Method | Description |
|---|---|
ReadFromColumn(string) |
Map to a different column name |
NotEmpty() |
Require non-empty value |
Default(T) |
Set default value if null/empty |
Convert(Func<string, T>) |
Custom converter function |
Convert(Func<string, TModel, T>) |
Converter with access to model instance |
Validate(string) |
Regex validation pattern |
WriteValue(T) |
Set a constant value |
ReadFromModel(Func<TModel, T>) |
Compute value from model |
Supported Types
- Primitives:
string,int,long,decimal,double,bool, etc. DateTime,DateTimeOffset,GuidNullable<T>for all value typesEnumtypes (case-insensitive)- Custom types via
Convert()method
Boolean Parsing
The library automatically handles multiple boolean representations:
true/false1/0yes/no
Error Handling
All import exceptions inherit from ImportException:
EmptyFileImportException- File contains no data rowsInvalidCellValueException- Cell value failed validation or conversionInvalidColumnValueException- Required column not foundInvalidPropertyNameException- Property doesn't exist on model
Each exception includes:
- Descriptive error message
- Row number (when applicable)
- Column name
- Property name
- Raw value that failed
License
MIT
| 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. |
NuGet packages (2)
Showing the top 2 NuGet packages that depend on PandaTech.FluentImporter:
| Package | Downloads |
|---|---|
|
Pandatech.ResponseCrafter
Exception-based error handling for ASP.NET Core 8+ with RFC 9457 ProblemDetails, structured logging, typed exceptions, automatic EF Core/Gridify/FluentImporter exception mapping, SignalR support, and flexible naming conventions. Alternative to Result pattern libraries. |
|
|
Pandatech.SharedKernel
Opinionated ASP.NET Core 10 infrastructure kernel: OpenAPI (Swagger + Scalar), Serilog, MediatR, FluentValidation, CORS, SignalR, OpenTelemetry, health checks, maintenance mode, resilience pipelines, and shared utilities. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 123 | 2/28/2026 |
| 4.0.1 | 150 | 1/26/2026 |
| 4.0.0 | 129 | 12/28/2025 |
| 3.0.9 | 328 | 9/8/2025 |
| 3.0.8 | 208 | 9/8/2025 |
| 3.0.7 | 211 | 9/8/2025 |
| 3.0.6 | 232 | 9/8/2025 |
| 3.0.5 | 363 | 8/7/2025 |
| 3.0.4 | 367 | 6/1/2025 |
| 3.0.2 | 374 | 3/12/2025 |
| 3.0.1 | 357 | 2/17/2025 |
| 3.0.0 | 676 | 11/21/2024 |
| 2.0.13 | 285 | 9/4/2024 |
| 2.0.12 | 639 | 5/16/2024 |
| 2.0.11 | 200 | 5/16/2024 |
| 2.0.10 | 176 | 5/16/2024 |
| 2.0.9 | 218 | 5/15/2024 |
| 2.0.8 | 185 | 5/13/2024 |
| 2.0.7 | 208 | 5/8/2024 |
| 2.0.6 | 311 | 5/6/2024 |
Multi-target net8.0/9.0/10.0, performance optimizations, updated dependencies, improved error messages