Work with Excel WorkSheets

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