PandaTech.FluentImporter 5.0.0

dotnet add package PandaTech.FluentImporter --version 5.0.0
                    
NuGet\Install-Package PandaTech.FluentImporter -Version 5.0.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="PandaTech.FluentImporter" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PandaTech.FluentImporter" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PandaTech.FluentImporter" />
                    
Project file
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 PandaTech.FluentImporter --version 5.0.0
                    
#r "nuget: PandaTech.FluentImporter, 5.0.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 PandaTech.FluentImporter@5.0.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=PandaTech.FluentImporter&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PandaTech.FluentImporter&version=5.0.0
                    
Install as a Cake Tool

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, Guid
  • Nullable<T> for all value types
  • Enum types (case-insensitive)
  • Custom types via Convert() method

Boolean Parsing

The library automatically handles multiple boolean representations:

  • true/false
  • 1/0
  • yes/no

Error Handling

All import exceptions inherit from ImportException:

  • EmptyFileImportException - File contains no data rows
  • InvalidCellValueException - Cell value failed validation or conversion
  • InvalidColumnValueException - Required column not found
  • InvalidPropertyNameException - 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on PandaTech.FluentImporter:

Package Downloads
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.

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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 206 2/28/2026
4.0.1 175 1/26/2026
4.0.0 153 12/28/2025
3.0.9 348 9/8/2025
3.0.8 226 9/8/2025
3.0.7 229 9/8/2025
3.0.6 255 9/8/2025
3.0.5 387 8/7/2025
3.0.4 390 6/1/2025
3.0.2 385 3/12/2025
3.0.1 370 2/17/2025
3.0.0 694 11/21/2024
2.0.13 303 9/4/2024
2.0.12 656 5/16/2024
2.0.11 216 5/16/2024
2.0.10 194 5/16/2024
2.0.9 238 5/15/2024
2.0.8 204 5/13/2024
2.0.7 233 5/8/2024
2.0.6 324 5/6/2024
Loading failed

Multi-target net8.0/9.0/10.0, performance optimizations, updated dependencies, improved error messages