.NET API for Microsoft® Excel Spreadsheets

Open-Source API to Import and Export Data from Excel File Format

What is Magicodes.IE?

Magicodes.IE is a pure .NET library that gives software developers the capability to import and export data from Microsoft Excel File Format. Using the API, you can import and export data as DTO, export general library, and export template, fancy & dynamic reports. The API does not allow manipulating XLS (Excel97-2003) file format and only supports XLSX and CSV file format.

One of the major features of the API is importing data as DTO. Magicodes.IE.Excel can automatically generate imported Excel templates, data validation, template validation, read settings, value constraints and mapping, and output Excel validation markup based on DTO and feature settings. Furthermore, the API supports various filters to support scenarios such as multi-language, dynamic control column display, and more.

Previous Next

Getting Started with Magicodes.IE

The best way to install Magicodes.IE is via NuGet, please use the following command to install the API.

Install Magicodes.IE from NuGet

 Install-Package Magicodes.IE.Excel

Import Data in Excel via Free .NET API

Magicodes.IE allows .NET programmers to import data in Microsoft Excel Spreadsheets programmatically. The API allows you to create DTO, generate import template and populate them with data. Using the API, you can easily call the import templates and import data in them. The following code snippet demonstrates, how to import data using an existing template. Please note that the code snippet is already using a predefined ImportStudentDto object.

Free .NET API to Import Excel Data

  1. Define a file path as a string
  2. Import data to excel using a predefined ImportStudentDto and template. You can also define your own DTO as per your need
  3. Check that the data is successfully imported and file it not null.

Import data in Excel - C#

// set filepath
var filePath = ("filefoamt.xlsx");
// import data                                           
var result = await Importer.GenerateTemplate(filePath);
// check that if data is not null
result.ShouldNotBeNull();
// check if output file existsa
File.Exists(filePath).ShouldBeTrue();