Get Worksheet Unique ID with C++

Get Worksheet Unique ID

Aspose.Cells provides the ability to get the unique ID of a worksheet by using the GetUniqueId() method. The following code snippet demonstrates the use of the GetUniqueId() method to print the unique ID of a worksheet. The following code snippet uses this sample excel file.

Source Code

#include <iostream>
#include "Aspose.Cells.h"

using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Source directory path
    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");

    // Load source Excel file
    Workbook workbook(srcDir + u"Book1.xlsx");

    // Access first worksheet
    Worksheet worksheet = workbook.GetWorksheets().Get(0);

    // Print Unique Id
    std::cout << "Unique Id: " << worksheet.GetUniqueId().ToUtf8() << std::endl;

    Aspose::Cells::Cleanup();
}