.Net Core Code

using IronXL;
using System.Linq;
WorkBook workbook = WorkBook.Load("test.xls");
WorkSheet sheet = workbook.WorkSheets.First();
//This is how we get range from Excel worksheet
var range = sheet["A2:A8"];
//This is how we can iterate over our range and read or edit any cell
foreach (var cell in range)
{
Console.WriteLine(cell.Value);
}
// Another Example
var oneMoreRange = sheet["A9:A10"];
//This is how we can combine our ranges into a single selection
var resultRange = range + oneMoreRange;
//Iterate over new range - get or set any Cell
foreach (var cell in resultRange)
{
Console.WriteLine(cell.Value);
}
Imports IronXL
Imports System.Linq
Private workbook As WorkBook = WorkBook.Load("test.xls")
Private sheet As WorkSheet = workbook.WorkSheets.First()
'This is how we get range from Excel worksheet
Private range = sheet("A2:A8")
'This is how we can iterate over our range and read or edit any cell
For Each cell In range
Console.WriteLine(cell.Value)
Next cell
' Another Example
Dim oneMoreRange = sheet("A9:A10")
'This is how we can combine our ranges into a single selection
Dim resultRange = range + oneMoreRange
'Iterate over new range - get or set any Cell
For Each cell In resultRange
Console.WriteLine(cell.Value)
Next cell
A Range
represents a selection of one or more cells in Excel.
With IronXL we can Read, Add, Sum, Average, Min, Max and Set Values over any Range of Cells.

using IronXL;
using System.Linq;
//Supported spreadsheet formats for reading include: XLSX, XLS, CSV and TSV
WorkBook workbook = WorkBook.Load("test.xlsx");
WorkSheet sheet = workbook.WorkSheets.First();
//Select cells easily in Excel notation and return the calculated value
int cellValue = sheet["A2"].IntValue;
// Read from Ranges of cells elegantly.
foreach (var cell in sheet["A2:A10"])
{
Console.WriteLine("Cell {0} has value '{1}'", cell.AddressString, cell.Text);
}
//Calculate aggregate values such as Min, Max and Sum
decimal sum = sheet["A2:A10"].Sum();
//Linq compatible
decimal max = sheet["A2:A10"].Max(c => c.DecimalValue);
Imports IronXL
Imports System.Linq
'Supported spreadsheet formats for reading include: XLSX, XLS, CSV and TSV
Private workbook As WorkBook = WorkBook.Load("test.xlsx")
Private sheet As WorkSheet = workbook.WorkSheets.First()
'Select cells easily in Excel notation and return the calculated value
Private cellValue As Integer = sheet("A2").IntValue
' Read from Ranges of cells elegantly.
For Each cell In sheet("A2:A10")
Console.WriteLine("Cell {0} has value '{1}'", cell.AddressString, cell.Text)
Next cell
'Calculate aggregate values such as Min, Max and Sum
Dim sum As Decimal = sheet("A2:A10").Sum()
'Linq compatible
Dim max As Decimal = sheet("A2:A10").Max(Function(c) c.DecimalValue)
IronXL is an Excel Library for C# and .Net which allows developers to Read and edit Excel data from XLS and XLSX Documents without using Microsoft.Office.Interop.Excel.
The API allows us to Create, Read, Manipulate, Save and Export Excel files intuitively for:
- .Net Framework 4.5+
- .Net Core 2+
- .Net Standard
- Xamarin
- Windows Mobile
- Mono
- & Azure Cloud hosting

using IronXL;
//This is how we create new worksheet
WorkBook workBook = WorkBook.Load("test.xlsx");
//This is how we create new worksheet
var newSheet = workBook.CreateWorkSheet("new_sheet");
//You can perform any operations you want with the new sheet.
newSheet["B2"].Value = DateTime.Now;
// Work with an existing Worksheets
WorkSheet oldSheet = workbook.GetWorkSheet("sheet1");
//...
// Work with the first Worksheet
WorkSheet firstSheet = workbook.DefaultWorkSheet;
//...
//Save in Excel format or export to many other file formats
workBook.SaveAs("test.xlsx");
Imports IronXL
'This is how we create new worksheet
Private workBook As WorkBook = WorkBook.Load("test.xlsx")
'This is how we create new worksheet
Private newSheet = workBook.CreateWorkSheet("new_sheet")
'You can perform any operations you want with the new sheet.
Private newSheet("B2").Value = Date.Now
' Work with an existing Worksheets
Private oldSheet As WorkSheet = workbook.GetWorkSheet("sheet1")
'...
' Work with the first Worksheet
Private firstSheet As WorkSheet = workbook.DefaultWorkSheet
'...
'Save in Excel format or export to many other file formats
workBook.SaveAs("test.xlsx")
An IronXL.WorkBook
represents and entire Excel (XLSX or XLS) file.
An IronXL.WorkSheet
represents one page or tab within that file.

using IronXL;
//Create new Excel WorkBook document.
//The default file format is XLSX, but we can override that for legacy support
WorkBook xlsWorkbook = WorkBook.Create(ExcelFileFormat.XLS);
xlsWorkbook.Metadata.Author = "IronXL";
//Add a blank WorkSheet
WorkSheet xlsSheet = xlsWorkbook.CreateWorkSheet("new_sheet");
//Add data and styles to the new worksheet
xlsSheet["A1"].Value = "Hello World";
xlsSheet["A2"].Style.BottomBorder.SetColor("#ff6600");
xlsSheet["A2"].Style.BottomBorder.Type = IronXL.Styles.BorderType.Double;
//Save the excel file
xlsWorkbook.SaveAs("NewExcelFile.xls");
Imports IronXL
'Create new Excel WorkBook document.
'The default file format is XLSX, but we can override that for legacy support
Private xlsWorkbook As WorkBook = WorkBook.Create(ExcelFileFormat.XLS)
xlsWorkbook.Metadata.Author = "IronXL"
'Add a blank WorkSheet
Dim xlsSheet As WorkSheet = xlsWorkbook.CreateWorkSheet("new_sheet")
'Add data and styles to the new worksheet
xlsSheet("A1").Value = "Hello World"
xlsSheet("A2").Style.BottomBorder.SetColor("#ff6600")
xlsSheet("A2").Style.BottomBorder.Type = IronXL.Styles.BorderType.Double
'Save the excel file
xlsWorkbook.SaveAs("NewExcelFile.xls")
The IronXL
library can be used to create Excel documents from in XLS and XLSX formats.
Using the IronXL API it is intuitive to populate your workbook and save it.

using IronXL;
//Import any XLSX,XLS, CSV or TSV Spreadsheet.
WorkBook workbook = WorkBook.Load("test.xls");
//Optionally Edit the Spreadsheet
workbook.Metadata.Title = "Import & Export Example";
//Export to many formats with fluent saving
workbook.SaveAs("test.xls");
workbook.SaveAs("export.xlsx");
workbook.SaveAsCsv("export.csv");
workbook.SaveAsJson("export.json");
workbook.SaveAsXml("export.xml");
//Also Export to a DataSet to allow easy integration with DataGrids, SQL and EF
System.Data.DataSet dataSet = workbook.ToDataSet();
Imports IronXL
'Import any XLSX,XLS, CSV or TSV Spreadsheet.
Private workbook As WorkBook = WorkBook.Load("test.xls")
'Optionally Edit the Spreadsheet
workbook.Metadata.Title = "Import & Export Example"
'Export to many formats with fluent saving
workbook.SaveAs("test.xls")
workbook.SaveAs("export.xlsx")
workbook.SaveAsCsv("export.csv")
workbook.SaveAsJson("export.json")
workbook.SaveAsXml("export.xml")
'Also Export to a DataSet to allow easy integration with DataGrids, SQL and EF
Dim dataSet As System.Data.DataSet = workbook.ToDataSet()
The IronXL
library can be used to create and export XLSX, XLS, CSV, TSV, JSON and XML documents.
We can also export to System.Data.DataSet
and System.Data.DataTable
objects for interoperability with SQL.

using IronXL;
using System.Data;
//Open any Excel document.
WorkBook workbook = WorkBook.Load("test.xls");
// Convert the whole Excel WorkBook to a DataSet
// This allows us to work with DataGrids and System.Data.SQL nicely
var dataSet = workbook.ToDataSet();
foreach (DataTable table in dataSet.Tables)
{
Console.WriteLine(table.TableName);
//Enumerate by rows or columns first at your preference
foreach (DataRow row in table.Rows)
{
for (int i = 0; i < table.Columns.Count; i++)
{
Console.Write(row[i]);
}
}
}
Imports IronXL
Imports System.Data
'Open any Excel document.
Private workbook As WorkBook = WorkBook.Load("test.xls")
' Convert the whole Excel WorkBook to a DataSet
' This allows us to work with DataGrids and System.Data.SQL nicely
Private dataSet = workbook.ToDataSet()
For Each table As DataTable In dataSet.Tables
Console.WriteLine(table.TableName)
'Enumerate by rows or columns first at your preference
For Each row As DataRow In table.Rows
For i As Integer = 0 To table.Columns.Count - 1
Console.Write(row(i))
Next i
Next row
Next table
Convert any XLS or XLSX Excel file (WorkBook) to a System.Data.DataTable
for full interoperability with System.Data.SQL
or to populate a DataGrid.

using IronXL;
using System.Data
//Open any Excel document.
WorkBook workbook = WorkBook.Load("test.xls");
// Work with a single WorkSheet. Can also use workbook.DefaultWorkSheet
WorkSheet sheet = workbook.GetWorkSheet("sheet1");
//Convert the worksheet to System.Data.DataTable
//Boolean parameter sets the first row as column names of your table.
System.Data.DataTable dataTable = sheet.ToDataTable(true);
//The DataTable can populate a DataGrid for example.
//Enumerate by rows or columns first at your preference
foreach (DataRow row in dataTable.Rows)
{
for (int i = 0; i < dataTable.Columns.Count; i++)
{
Console.Write(row[i]);
}
}
Imports IronXL
Imports System.Data WorkBook workbook = WorkBook.Load("test.xls")
'Open any Excel document.
' Work with a single WorkSheet. Can also use workbook.DefaultWorkSheet
Private sheet As WorkSheet = workbook.GetWorkSheet("sheet1")
'Convert the worksheet to System.Data.DataTable
'Boolean parameter sets the first row as column names of your table.
Private dataTable As System.Data.DataTable = sheet.ToDataTable(True)
'The DataTable can populate a DataGrid for example.
'Enumerate by rows or columns first at your preference
For Each row As DataRow In dataTable.Rows
For i As Integer = 0 To dataTable.Columns.Count - 1
Console.Write(row(i))
Next i
Next row
Convert any Excel worksheet to a System.Data.DataTable
for full interoperability with System.Data.SQL
or to populate a DataGrid.

Technical Support From Our .Net Core Team
Get in touch with our product development and support team. Our team are on hand to answer your questions regarding licensing, product and usage for your project.
Raise a Support Ticket
Work with Excel Files in .NET Core
A quick and easy approach to work with Excel and other Spreadsheet documents in dot net core. Works in dotnet core for multiple platforms including Azure with no extra dependencies or need to install MS Office or Interop.
Works with .NET Core, C#, .NET, XLSX, VB.NET
Feature List
Open & Save Multiple File Formats
IronXL allows .Net engineers to write and export Excel Spreadsheets from dotnet Core APPs. Open and Edit XLS/XLSX/CSV/TSV - Save and Export to XLS/XLSX/CSV/TSV/JSON. IronXL out performs free and Interop libraries at parsing, altering, and saving Excel documents.
Get Started
SQL Support Out-of-the-box
Transfer Data between Excel, SQL and GridViews by opening spreadsheets as System.Data.DataSet and System.Data.DataTable objects.
View Code Examples
Modify Excel Data
Edit Microsoft Excel formulas - recalculate every time a work sheet it changed. Quick and Easy WorkSheet [“A1:B10”] formatting. Merge and set Ranges, Columns and Rows.
Documentation
Style Your Excel Documents
Set Font, Size, Background, Border, Alignment and Number format.
Get StartedEasy to Build with Visual Studio for .Net Core Projects
IronXL puts Excel Tools in your own hands with intellisense support. Install with Nuget for Visual Studio or a manual DLL download free for .Net Core. You'll be set up in the blink of an eye.
Download DLL PM > Install-Package IronXL.ExcelSupports:
Licensing & Pricing for .Net Core
Free for development. Licenses from $399.

Project

Developer

Organization

Agency

SaaS

OEM
Excel Spreadsheet Tutorials for Dot Net Core

C# Excel ASP.Net

How to Create Excel Files in .Net Core
See How Jonas uses IronXL to generate Excel Files without using Office Interop...
View Jonas' Excel File Generation Tutorial
C# Excel XLS

Open and Edit Excel Files in C# or VB.NET
Elijah shares a no-nonsense approach to reading Excel data into C# Applications...
See Elijah's Excel Reading & Editing Tutorial
C# Excel Data

How to Read Excel Files into .Net Apps.
Rebecca's code walkthrough for reading Excel data into a .Net application...
Read Becky's C# Tutorial.NET Core Engineers use IronXL for...
Accounting and Finance Systems
- # Receipts
- # Reporting
- # Invoice Printing
Business Digitization
- # Documentation
- # Ordering & Labelling
- # Paper Replacement

Enterprise Content Management
- # Content Production
- # Document Management
- # Content Distribution

Data and Reporting Applications
- # Performance Tracking
- # Trend Mapping
- # Reports

Thousands of corporations, governments, SMEs and developers alike trust Iron software products.
Iron's team have over 10 years experience in the .Net software component market.







