Get Started with Code Samples

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 = DateTime.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.
You can download a file project from this link.

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;
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.
How to Iterate Over Range and Read or Edit any Cell
- Download C# Excel Range Library
- Install in Visual Studio
- Insert Code WorkSheet sheet = workbook.WorkSheets.First();
- View Your Excel Range Document
You can download the software product from this link.

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.
You can download a file project from this link.

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
Private System As using
' 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.
You can download a file project from this link.

Direct Support from Our VB .NET Development Team
The Iron Visual Basic .NET product development team is available to support your questions. Get in touch to make the most of our library in your project.
Raise a Ticket
Work with Excel Files in VB.NET
Quick way to work with Excel Worksheets in Visual Basic VB.Net. Works in VB .NET Core and Azure with no special dependencies and no need to install MS Office or Interop.
Works with VB .Net, C#, .NET, XLSX, .NET Core
See Full Function List
Read & Write Excel Files in VB.NET
IronXL allows you to read Excel data from Spreadsheets in your .NET APPs. Read & Edit XLS/XLSX/CSV/TSV - Save & Export to XLS/XLSX/CSV/TSV/JSON.
More
Native SQL Support
Move Data between Excel, SQL and GridViews by accessing worksheets as System.Data.DataSet and System.Data.DataTable objects.
Get Started
Update Excel Data in Visual Basic .Net
Works with Microsoft Excel formulas - recalculate if a worksheet it updated. Easy to use WorkSheet [“A1:B10”] syntax. Sort by Ranges, Columns and Rows.
More
Style Excel Sheet Cells with VB
Set Font, Size, Background, Border, Alignment and Number format.
Get Started NowInstall into Microsoft Visual Studio
IronXL gives you Excel generation and editing tools. Install directly from NuGet or download the DLL.
PM > Install-Package IronXL.Excel Download VB.Net DLLSupports:
Licensing & Pricing
Free community development licenses. Licenses from $499.

Project

Developer

Organization

Agency

SaaS

OEM
Excel Spreadsheet Tutorials for VB .Net

VB Excel ASP.Net

How to Create Excel Files in .Net
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 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# TutorialProfessional developers 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.







