An IronXL.WorkBook
represents and entire Excel (XLSX or XLS) file.
An IronXL.WorkSheet
represents one page or tab within that file.
C#:
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");
VB:
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")
Top comments (0)