Thanks for your posting and using Aspose.Cells for .NET.
Please use the Workbook.Worksheets.ActiveSheetIndex property for your needs. You can set your desired sheet using this property and MS-Excel will display this sheet on opening the file.
Please first set the license and then load your workbook and set the active worksheet using the Workbook.Worksheets.ActiveSheetIndex property.
Please see here how I am setting the license.
I have attached the sample Excel file used in this code and the output Excel file generated by it for your reference. As you can see in the output Excel file, the second worksheet is the active worksheet.
C#
//First set the license
Aspose.Cells.License lic = new Aspose.Cells.License();
lic.SetLicense(@“F:\Aspose.Total.lic”);
//Load your workbook
Workbook workbook = new Workbook(@“F:\Shak-Data-RW\Downloads\sample.xlsx”);
//Set second worksheet as active worksheet, index starts from 0,
We have evaluated your presented scenario while using the latest version of Aspose.Cells for .NET 8.2.1, and was unable to observe any issue. The resultant spreadsheet has active worksheet set to “xyz” that is expected behavior. Please note, you have to set the license before creating an instance of Workbook in order to make your code work as desired. Moreover, if you are using any older version of the API, please give a try to the latest version (link shared above).
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.