CoreExcelPackage 2025.7.13

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

ExecutionEngine.Excel

NuGet Version .NET Standard License

Una biblioteca moderna y eficiente para el manejo de archivos Excel (.xls y .xlsx) en aplicaciones .NET, diseñada para ofrecer un rendimiento óptimo y una API intuitiva tanto para operaciones síncronas como asíncronas.

Características Principales

  • Soporte multiplataforma: Compatible con .NET Standard 2.0+ y .NET 6.0+
  • Rendimiento optimizado: Lectura y escritura eficiente de archivos Excel
  • Soporte asíncrono: Todas las operaciones principales tienen versiones asíncronas
  • Tipado fuerte: Conversión automática a tipos fuertemente tipados
  • Soporte para:
    • Formatos .xls y .xlsx
    • Múltiples hojas de cálculo
    • Operaciones con DataTable
    • Streams para procesamiento sin almacenamiento en disco
    • Inyección de dependencias

Instalación

Instala el paquete NuGet en tu proyecto:

dotnet add package ExecutionEngine.Excel

O a través del Administrador de paquetes NuGet en Visual Studio:

Install-Package ExecutionEngine.Excel

Uso Básico

Configuración de Inyección de Dependencias

// En tu Startup.cs o configuración de servicios
services.AddExcelPackage();

Ejemplos de Código

Lectura de datos
using ExecutionEngine.Excel.Implementations;

// Crear una instancia
var excelPackage = new ExcelPackage();

// Cargar archivo
await excelPackage.SetDatabaseLogonAsync("ruta/al/archivo.xlsx");

// Obtener nombres de hojas
var sheetNames = excelPackage.GetSheetNames();

// Leer datos como DataTable
var dataTable = await excelPackage.GetTableAsync("Hoja1");

// Leer datos como lista fuertemente tipada
var items = await excelPackage.GetItemsAsync<MiModelo>("Hoja1");

// Liberar recursos
excelPackage.Dispose();
Escritura de datos
using var excelPackage = new ExcelPackage();

// Crear una nueva hoja con datos
var data = new List<MiModelo> 
{ 
    new MiModelo { Id = 1, Nombre = "Ejemplo" } 
};

await excelPackage.CreateSheetAsync("MiHoja", data);

// Guardar a archivo
await excelPackage.SaveAsAsync("ruta/guardado.xlsx");
Uso con Streams
using var stream = new MemoryStream();
using var excelPackage = new ExcelPackage();

// Cargar desde stream
await excelPackage.SetDatabaseLogonAsync(stream);

// Procesar datos...

// Guardar a otro stream
using var outputStream = new MemoryStream();
await excelPackage.SaveAsAsync(outputStream);

Modelado de Datos

Puedes mapear tus clases a las hojas de Excel usando atributos:

public class Producto
{
    [ExcelColumn("ID", 1)]
    public int Id { get; set; }
    
    [ExcelColumn("NOMBRE", 2)]
    public string Nombre { get; set; }
    
    [ExcelColumn("PRECIO", 3, Format = "C2")]
    public decimal Precio { get; set; }
    
    [ExcelColumn("FECHA_REGISTRO", 4, Format = "dd/MM/yyyy")]
    public DateTime FechaRegistro { get; set; }
}

Manejo de Errores

Todas las operaciones lanzan excepciones específicas que puedes capturar:

try
{
    await excelPackage.SetDatabaseLogonAsync("archivo_inexistente.xlsx");
}
catch (ExcelFileNotFoundException ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}
catch (ExcelException ex)
{
    Console.WriteLine($"Error de Excel: {ex.Message}");
}

Rendimiento

Para archivos grandes, se recomienda:

  1. Usar los métodos asíncronos
  2. Procesar los datos en lotes
  3. Utilizar streams en lugar de operaciones de archivo directas
  4. Liberar recursos con using o llamando a Dispose()

Contribución

Las contribuciones son bienvenidas. Por favor, lee las pautas de contribución antes de enviar un pull request.

Licencia

Este proyecto está licenciado bajo la licencia MIT. Consulta el archivo LICENSE para más detalles.

Product Compatible and additional computed target framework versions.
.NET 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.  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 was computed.  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. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.7.13 34 7/14/2025
2025.7.8 111 7/8/2025
2025.7.2 93 7/4/2025
2025.6.26 95 6/27/2025
2025.6.12 268 6/11/2025
2025.6.11 266 6/11/2025
2025.5.23 61 5/23/2025
2025.5.8 128 5/8/2025
2025.5.4 135 5/4/2025
2025.5.1 129 5/1/2025
2025.4.30 124 4/30/2025
2025.3.22 147 3/22/2025
2025.3.8 120 3/9/2025
2025.2.1 102 2/1/2025
2024.12.4 109 12/4/2024
2024.11.12 109 11/12/2024
2024.10.6 106 10/4/2024
2024.10.5 95 10/3/2024
2024.10.4 96 10/3/2024
2024.10.3 94 10/3/2024
2024.9.5 113 9/6/2024
2024.8.13 121 8/14/2024
2024.8.1 94 8/1/2024
2024.7.24 94 7/24/2024
2024.7.13 90 7/14/2024
2024.5.25 104 5/25/2024
2024.4.12 133 4/13/2024
2024.4.7 112 4/8/2024
2023.11.30 205 12/11/2023
2023.11.28 137 11/27/2023