1. Products
  2.   Spreadsheet
  3.   GO
  4.   Aspose.Cells Go via C++

Aspose.Cells Go via C++

 
 

Go Excel API to Create & Convert Spreadsheets via C++

C++ Developers Can Now Create, Read, Modify, Manipulate, Parse, Split, Merge & Convert Excel Spreadsheets, Validate and Process Data Through C++ Bindings Using Cgo.

What is Aspose.Cells Go via C++?

In today's data-driven world, working with Excel spreadsheets programmatically has become essential for businesses and developers alike. Aspose.Cells Go via C++ is a powerful library that bridges the gap between Go programming and Excel manipulation, offering developers a robust solution for creating, editing, and converting spreadsheet files without requiring Microsoft Excel installation. The library supports a wide range of spreadsheet operations including creation, conversion, editing, formatting, data validation, formula calculation, and much more. It works seamlessly with popular Excel formats such as XLS, XLSX, XLSM, and XLSB, along with tabular data file formats (CSV, TSV), OpenDocument Spreadsheet format(ODS), Web-friendly spreadsheet representation(HTML) and others like SXC, FODS, EPUB etc. The API also included support for export to PDF, images, and other formats.

Aspose.Cells Go via C++ stands out as a specialized version of the popular Aspose.Cells library, optimized for C++ developers working with Go (Golang) integration scenarios. It bridges the gap between C++ performance and Go's simplicity, offering a versatile toolset for spreadsheet automation across multiple platforms. The API can run on major platforms, including Windows and Linux, making it suitable for cloud-native and traditional environments. The library's zero-dependency architecture eliminates concerns about Microsoft Office licensing and installation, while its support for multiple file formats ensures compatibility with various systems and workflows. Whether you're building enterprise reporting systems, data processing pipelines, or automated document generation tools, Aspose.Cells Go via C++ provides the functionality and reliability you need.

Previous Next

Getting Started with Aspose.Cells Go via C++

The recommend way to install Aspose.Cells Go via C++ in using NuGet. Please use the following command for a smooth installation.

Install Aspose.Cells Go via C++ via NuGet

PM> Install-Package Aspose.Cells.Go.Cpp 
You can also download it directly from Aspose product release page.

Create & Manipulate Excel Workbooks via Go

Aspose.Cells Go via C++ has provided powerful support for creating and working with various Excel spreadsheet file formats. Software developers can create new workbooks or modify existing ones, including worksheets, cell values, styles, and layout. The following code example shows how to create a new Excel workbook from scratch and populate it with data. After creating a workbook instance, we access the first worksheet using GetWorksheets().Get(0).

How to Create and Populate an Excel Workbook via Go API?

// Create a new workbook
workbook, err := NewWorkbook()
if err != nil {
    log.Fatal(err)
}

// Access the first worksheet
worksheet := workbook.GetWorksheets().Get(0)

// Add data to cells
cells := worksheet.GetCells()
cells.Get_String("A1").PutValue_String("Product")
cells.Get_String("B1").PutValue_String("Price")
cells.Get_String("C1").PutValue_String("Quantity")

// Add sample data
cells.Get_String("A2").PutValue_String("Laptop")
cells.Get_String("B2").PutValue_Int(1200)
cells.Get_String("C2").PutValue_Int(5)

cells.Get_String("A3").PutValue_String("Mouse")
cells.Get_String("B3").PutValue_Int(25)
cells.Get_String("C3").PutValue_Int(50)

// Save the workbook
workbook.Save_String("../Data/Output/Product_Inventory.xlsx")

Excel Data Processing and Manipulation

Data validation is crucial for maintaining data integrity. Aspose.Cells Go via C++ excels at data processing with features like data validation to restrict input, sorting and filtering operations, AutoFilter implementation, find and replace functionality, row and column manipulation, dell merging and splitting, data grouping and outlining and more. This example creates a validation rule that restricts input in cells A2 through A100 to whole numbers between 18 and 65.

How to Perform Data Validation in Excel Spreadsheets via Go API?

// Create a new workbook
workbook, _ := NewWorkbook()
worksheet := workbook.GetWorksheets().Get(0)
cells := worksheet.GetCells()

// Add header
cells.Get_String("A1").PutValue_String("Age")

// Get validation collection
validations := worksheet.GetValidations()

// Add validation for cell A2
validation := validations.Add()
validation.SetType(ValidationTypeWholeNumber)
validation.SetOperator(OperatorTypeBetween)
validation.SetFormula1("18")
validation.SetFormula2("65")

// Apply validation to specific cell area
area := validation.GetAreaList()
area.Add_CellArea(NewCellArea("A2", "A100"))

// Set error message
validation.SetErrorMessage("Please enter an age between 18 and 65")
validation.SetShowError(true)

// Save the workbook
workbook.Save_String("../Data/Output/Validated_Data.xlsx")

Excel File Conversion to PDF via Go

One of the most common use cases is converting Excel files between different file formats. Aspose.Cells Go via C++ has provided a complete support for loading and converting Excel spreadsheets into various other file formats like XLSX, CSV, PDF and more etc. The following example demonstrates how straightforward this process is with Aspose.Cells Go via C++. With just two lines of code per format, you can convert spreadsheets between any supported formats without worrying about format-specific implementation details.

How to Load and Convert Excel Spreadsheets via Go API?

// Load the document for conversion
workbook, _ := NewWorkbook()
// Save in different formats
workbook.Save_String("../Data/Output/HELLO_Convert.xlsx")
workbook.Save_String("../Data/Output/HELLO_Convert.xlsb")
workbook.Save_String("../Data/Output/HELLO_Convert.csv")

Manage Hyperlinks & Comments Excel via Go

Aspose.Cells for Go via C++ provides full control over hyperlinks and cell comments, allowing software developers to enrich spreadsheets with navigation, references, and contextual notes. This is especially useful for reports, dashboards, audit sheets, and collaborative documents where explanations and external references matter. Developers can also add comments and notes to cells for documentation purposes. The following example demonstrates how developers can add a hyperlink to worksheet cell inside Go apps.

How to Add a Hyperlink to a Worksheet Cell via Go API?

// Add a hyperlink to cell A1
links := sheet.Hyperlinks()
links.Add_String_String("A1", 1, 1, "https://products.aspose.com/cells/go-cpp/")

// Set display text
sheet.Cells().Get("A1").PutValue("Aspose.Cells for Go via C++")

Zero Microsoft Excel Dependency

One of the most significant advantages of Aspose.Cells Go via C++ is its complete independence from Microsoft Excel. The library operates without requiring any Microsoft Office components installed on your system, making it ideal for Linux server deployments, cloud-based applications, Containerized environments, systems where Excel licensing is impractical and many more.