C# + VB.Net: Work with Excel WorkSheets in VB .Net Work with Excel WorkSheets in VB .Net
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.

C# + VB.Net: Read Excel Files without Interop Read Excel Files without Interop
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
IronXL also fully supports ASP.Net, MVC, Windows, MacOS, Linux, iOS, Android and Windows Mobile application development.

C# + VB.Net: Work with Excel Ranges Work with Excel Ranges
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.

C# + VB.Net: Create a new Excel File Create a new Excel 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.

C# + VB.Net: Convert Spreadsheet File Types Convert Spreadsheet File Types
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.

C# + VB.Net: Excel to SQL via System.Data.DataSet Excel to SQL via System.Data.DataSet
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.

C# + VB.Net: Excel to SQL and DataGrid via DataTable Excel to SQL and DataGrid via DataTable
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.

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 dependancies 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 Now
Visual Studio - VB Create Excel Spreadsheet .Net Library - for Excel document Creation and Editing.

Install 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 DLL
Supports:
  • .Net Core 2.0 and above
  • .Net Framework 4.0 and above support C#, VB, F#
  • Microsoft Visual Studio. .Net Development IDE Icon
  • Nuget Installer Support for Visual Studio
  • JetBrains ReSharper C# language assistant compatible
  • Microsoft Azure C# .NET  hosting platform compatible

Licensing & Pricing

Free community development licenses. Licenses from $399.

Project C# + VB.NET Library Licensing

Project

Developer C# + VB.NET Library Licensing

Developer

Organization C# + VB.NET Library Licensing

Organization

Agency C# + VB.NET Library Licensing

Agency

SaaS C# + VB.NET Library Licensing

SaaS

OEM C# + VB.NET Library Licensing

OEM

View Full License Options  

Excel Spreedsheet Tutorials for VB .Net

How to Create Excel Files in VB

VB Excel ASP.Net

Jonas Schmidt - C# Developer

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
Reading and Writing Excel Tutorial + Code Examples in C# & VB.Net

C# Excel XLS

Elijah Williams - Product Development Engineer

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
Tutorial + Code Examples VB.Net PDF Creation and Editing | VB.Net & ASP.Net PDF

C# Excel Data

Rebecca White - .Net Solution Director

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
Professional developers use IronXL for...

Accounting and Finance Systems

  • # Receipts
  • # Reporting
  • # Invoice Printing
Add Excel Support to ASP.Net Accounting and Finance Systems

Business Digitization

  • # Documentation
  • # Ordering & Labelling
  • # Paper Replacement
C# Business Digitization Use Cases

Enterprise Content Management

  • # Content Production
  • # Document Management
  • # Content Distribution
.Net CMS Excel Support

Data and Reporting Applications

  • # Performance Tracking
  • # Trend Mapping
  • # Reports
C# Excel Reports
Join Them Today
Iron Software Enterprise .Net Component Developers

Thousands of corporations, governments, SME's and developers alike trust Iron software products.

Iron's team have over 10 years experience in the .Net software component market.

Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Download DLL or Install with Nuget