Get Excel sheet name using ClosedXML in C# and VB.Net

Last Reply 11 months ago By pandeyism

Posted 11 months ago

How to get the excel sheet name in c#?

Posted 11 months ago


Refer below link there is writen code how to get sheet name.

And refer below code same as link code.

Export Excel with multiple sheets to multiple DataTables using ClosedXML in Windows Application


foreach (IXLWorksheet workSheet in workBook.Worksheets)
    DataTable dt = new DataTable();
    IXLWorksheet worksheet = workBook.Worksheet(workSheet.Name);
    dt.TableName = workSheet.Name;


For Each workSheet As IXLWorksheet In workBook.Worksheets
    Dim dt As DataTable = New DataTable()
    Dim worksheet As IXLWorksheet = workBook.Worksheet(workSheet.Name)
    dt.TableName = workSheet.Name