Free Support Forum - groupdocs.com

Get sheet names for Excel documents using document viewer API for .NET

Hi.

Please could you provide an API to get names of Excel’s Sheets? I didn’t found such functionality in GroupDocs.Viewer for .NET API reference (https://apireference.groupdocs.com/viewer/net)

1 Like

@paraben

We are investigating this scenario with ID VIEWERNET-2485. You’ll be notified about the outcomes soon.

@paraben

We’ve an update on VIEWERNET-2485. The requested feature will be implemented in API version 20.6 that is expected by the end of June. We’ll notify you as release gets on-board.

@paraben

We’ve added a new feature to get sheet names in API version 20.6.

using (Viewer viewer = new Viewer("sample.xlsx"))
{
    ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForHtmlView();
    viewInfoOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();

    ViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions);

    Console.WriteLine("Worksheets:");
    foreach (Page page in viewInfo.Pages)
    {
        Console.WriteLine($" - Worksheet {page.Number} name '{page.Name}'");
    }
}

Please explore this documentation article for further details.