ArrayToExcel 2.4.6

dotnet add package ArrayToExcel --version 2.4.6                
NuGet\Install-Package ArrayToExcel -Version 2.4.6                
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="ArrayToExcel" Version="2.4.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArrayToExcel --version 2.4.6                
#r "nuget: ArrayToExcel, 2.4.6"                
#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.
// Install ArrayToExcel as a Cake Addin
#addin nuget:?package=ArrayToExcel&version=2.4.6

// Install ArrayToExcel as a Cake Tool
#tool nuget:?package=ArrayToExcel&version=2.4.6                

ArrayToExcel

Create Excel from Array (List, DataTable, DataSet, ...)

Example 1: Create with default settings

using ArrayToExcel;

var items = Enumerable.Range(1, 10).Select(x => new
{
    Prop1 = $"Text #{x}",
    Prop2 = x * 1000,
    Prop3 = DateTime.Now.AddDays(-x),
});

var excel = items.ToExcel();

Result: example1.xlsx

alternate text is missing from this package README image

Example 2: Rename sheet and columns

var excel = items.ToExcel(schema => schema
    .SheetName("Example name")
    .ColumnName(m => m.Name.Replace("Prop", "Column #")));

Result: example2.xlsx

alternate text is missing from this package README image

Example 3: Sort columns

var excel = items.ToExcel(schema => schema
    .ColumnSort(m => m.Name, desc: true));

Result: example3.xlsx

alternate text is missing from this package README image

Example 4: Custom column's mapping

var excel = items.ToExcel(schema => schema
    .AddColumn("MyColumnName#1", x => new CellHyperlink($"https://www.google.com/search?q={x.Prop1}", x.Prop1))
    .AddColumn("MyColumnName#2", x => $"test:{x.Prop2}")
    .AddColumn("MyColumnName#3", x => x.Prop3));

Result: example4.xlsx

alternate text is missing from this package README image

Example 5: Additional sheets

var excel = items.ToExcel(schema => schema
    .SheetName("Main")
    .AddSheet(extraItems));

Result: example5.xlsx

alternate text is missing from this package README image

Example 6: Create from DataSet

var dataSet = new DataSet();

for (var i = 1; i <= 3; i++)
{
    var table = new DataTable($"Table{i}");
    dataSet.Tables.Add(table);

    table.Columns.Add($"Column {i}-1", typeof(string));
    table.Columns.Add($"Column {i}-2", typeof(int));
    table.Columns.Add($"Column {i}-3", typeof(DateTime));

    for (var x = 1; x <= 10 * i; x++)
        table.Rows.Add($"Text #{x}", x * 1000, DateTime.Now.AddDays(-x));
}

var excel = dataSet.ToExcel();

Result: example6.xlsx

alternate text is missing from this package README image

Example.ConsoleApp

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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. 
.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 net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ArrayToExcel:

Package Downloads
AvvaMobile.Core

This package is build for Avva Mobile developers to make their solutions easy to develop.

RSCG_WebAPIExports

Add Excel export to your WebAPI

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.6 1,092 9/25/2024
2.4.5 11,556 2/3/2024
2.4.0 135 1/31/2024
2.3.0 1,700 1/8/2024
2.2.4 169 1/8/2024
2.2.3 2,294 11/14/2023
2.2.2 21,345 5/25/2023
2.2.1 43,669 11/9/2022
2.2.0 2,772 9/27/2022
2.1.0 2,580 9/12/2022
2.0.7 15,494 2/15/2022
2.0.6 2,241 1/8/2022
2.0.5 415 12/4/2021
2.0.4 1,129 11/13/2021
2.0.3 419 11/7/2021
2.0.2 338 11/7/2021
2.0.1 439 11/7/2021
2.0.0 349 11/6/2021
1.0.2 3,671 7/27/2021
1.0.1 26,627 2/7/2020
1.0.0 568 2/4/2020