IntNovAction.Utils.ExcelImporter 0.0.1

Package Description

There is a newer version of this package available.
See the version list below for details.
Install-Package IntNovAction.Utils.ExcelImporter -Version 0.0.1
dotnet add package IntNovAction.Utils.ExcelImporter --version 0.0.1
<PackageReference Include="IntNovAction.Utils.ExcelImporter" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IntNovAction.Utils.ExcelImporter --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

IntNovAction.Utils.ExcelImporter

Utility to import excel data into POCOs

The usage is quite simple:


// Define the destination POCO class

class SampleImportInto
{
    public int IntColumn { get; set; }
    public int? NullableIntColumn { get; set; }
    public decimal DecimalColumn { get; set; }
    public decimal? NullableDecimalColumn { get; set; }
    public float FloatColumn { get; set; }
    public float? NullableFloatColumn { get; set; }
    public string StringColumn { get; set; } 
    public DateTime DateColumn { get; set; }
    public DateTime? NullableDateColumn { get; set; }
    public bool BooleanColumn { get; set; }
    public bool? NullableBooleanColumn { get; set; }
}

// Read the excel file 
using (var stream = OpenExcel())
{
    // Create the typed importer
    var importer = new Importer<SampleImportInto>();

    // Configure
    importer
        .SetErrorStrategy(ErrorStrategy.AddElement)
        .FromExcel(stream, "Data With Errors")
        .For(p => p.IntColumn, "Int Column")
        .For(p => p.FloatColumn, "Float Column")
        .For(p => p.DecimalColumn, "Decimal Column")
        .For(p => p.NullableIntColumn, "Nullable Int Column")
        .For(p => p.NullableFloatColumn, "Nullable Float Column")
        .For(p => p.NullableDecimalColumn, "Nullable Decimal Column")
        .For(p => p.StringColumn, "String Column")
        .For(p => p.DateColumn, "Date Column")
        .For(p => p.NullableDateColumn, "Nullable Date Column")
        .For(p => p.BooleanColumn, "Boolean Column")
        .For(p => p.NullableBooleanColumn, "Nullable Boolean Column");

    // Import
    var importResults = importer.Import();
    
    // Read the imported objects...
    var numImportedItems = importResults.ImportedItems.Count();

    // Check the errors...
	var numImportedObjects = importResults.Errors.Count();
}

IntNovAction.Utils.ExcelImporter

Utility to import excel data into POCOs

The usage is quite simple:


// Define the destination POCO class

class SampleImportInto
{
    public int IntColumn { get; set; }
    public int? NullableIntColumn { get; set; }
    public decimal DecimalColumn { get; set; }
    public decimal? NullableDecimalColumn { get; set; }
    public float FloatColumn { get; set; }
    public float? NullableFloatColumn { get; set; }
    public string StringColumn { get; set; } 
    public DateTime DateColumn { get; set; }
    public DateTime? NullableDateColumn { get; set; }
    public bool BooleanColumn { get; set; }
    public bool? NullableBooleanColumn { get; set; }
}

// Read the excel file 
using (var stream = OpenExcel())
{
    // Create the typed importer
    var importer = new Importer<SampleImportInto>();

    // Configure
    importer
        .SetErrorStrategy(ErrorStrategy.AddElement)
        .FromExcel(stream, "Data With Errors")
        .For(p => p.IntColumn, "Int Column")
        .For(p => p.FloatColumn, "Float Column")
        .For(p => p.DecimalColumn, "Decimal Column")
        .For(p => p.NullableIntColumn, "Nullable Int Column")
        .For(p => p.NullableFloatColumn, "Nullable Float Column")
        .For(p => p.NullableDecimalColumn, "Nullable Decimal Column")
        .For(p => p.StringColumn, "String Column")
        .For(p => p.DateColumn, "Date Column")
        .For(p => p.NullableDateColumn, "Nullable Date Column")
        .For(p => p.BooleanColumn, "Boolean Column")
        .For(p => p.NullableBooleanColumn, "Nullable Boolean Column");

    // Import
    var importResults = importer.Import();
    
    // Read the imported objects...
    var numImportedItems = importResults.ImportedItems.Count();

    // Check the errors...
	var numImportedObjects = importResults.Errors.Count();
}

Release Notes

Alpha version, not recommended for production use yet.

Version History

Version Downloads Last updated
0.0.7 77 3/12/2019
0.0.6 102 12/29/2018
0.0.5 136 9/24/2018
0.0.4 151 9/17/2018
0.0.3 125 9/17/2018
0.0.2 110 9/14/2018
0.0.1 108 9/14/2018
Show less