Manage Workbook with Golang via C++

Creating a New Workbook

To create a new workbook:

  1. Create an instance of the Workbook class.
  2. Add worksheets to the workbook using the WorksheetCollection class.
  3. Save the workbook using the Save method.

Opening an Existing Workbook

To open an existing workbook:

  1. Create an instance of the Workbook class and pass the file path to the constructor.
  2. Access the worksheets using the WorksheetCollection class.
  3. Modify the workbook as needed.
  4. Save the workbook using the Save method.

Managing Worksheets

Aspose.Cells for C++ provides a wide range of methods for managing worksheets, including adding, removing, and renaming worksheets.

Adding a Worksheet

To add a new worksheet:

  1. Access the WorksheetCollection class from the workbook.
  2. Use the Add method to add a new worksheet.

Removing a Worksheet

To remove a worksheet:

  1. Access the WorksheetCollection class from the workbook.
  2. Use the RemoveAt method to remove a worksheet by index.

Renaming a Worksheet

To rename a worksheet:

  1. Access the Worksheet class from the workbook.
  2. Use the SetName method to rename the worksheet.

Conclusion

Aspose.Cells for C++ provides a comprehensive set of tools for managing workbooks and worksheets. Whether you need to create a new workbook, open an existing one, or manipulate worksheets, Aspose.Cells makes it easy to work with Excel files programmatically.