Aspose.Cells is far more than a spreadsheet reader/writer—it is a full-blown, Excel-compatible calculation and reporting engine that lets you turn raw data into report documents without installing Microsoft Office anywhere in your pipeline. Here is an expanded map of what “data analysis, processing, and professional reporting” actually look like with the API, plus concrete performance figures and code patterns you can paste into your own project today.

1. Environmental Preparation

First, make sure Aspose.Cells for Go via C++ library is installed.

# Linux/macOS
ls $(go env GOMODCACHE)

# Windows (PowerShell)
Get-ChildItem $env:GOPATH\github.com\aspose-cells\aspose-cells-go-cpp\

Second, how to install Aspose.Cells for Go via C++ library, please refer to Aspose.Cells for Go via C++ online document or Aspose.Cells for Go via C++ Readme.

2. Data loading and basic operations

Main functions in Aspose.Cells for Go via C++:

  • Create or load a spreadsheet
  • Data sorting
  • Data Filtering
  • Conditional Formatting

We will leverage the GoLang ecosystem, combined with Aspose.Cells for Go via C++ APIs, practical code, application scenarios, and best practices, to help clients efficiently handle Excel data.

  1. Please review the following code to learn how to create a spreadsheet or load an existing one.
// New Workbook, and get the worksheet whose index is 0
workbook, _ := NewWorkbook()
worksheets, _ := workbook.GetWorksheets()
worksheet, _ := worksheets.Get_Int(0)

// Load an existing Excel file, and get the worksheet whose index is 0
sourceWorkbook, _ := NewWorkbook_String("data_source.xlsx")
sourceWorksheets, _ := sourceWorkbook.GetWorksheets()
sourceWorksheet, _ := sourceWorksheets.Get_Int(0)
  1. Please review the following code to learn how to sort data in an Excel file.
// Create cell area
cell_area ,_ := CellArea_CreateCellArea_Int_Int_Int_Int(0,0,100,10)
// Create DataSorter
sorter, _ = workbook.GetDataSorter()
// Set sort order rule
sorter.SetOrder1(SortOrder_Ascending)
// Set sort column
sorter.SetKey1(0)
// Sort
sorter.Sort()
  1. Please review the following code to learn how to filter data in an Excel file.
// Get auto filter of worksheet
filter,_ = worksheet.GetAutoFilter()
// Set Range, the parameter is the range of the cell, data type is string.
filter.SetRange_String("A1:D1000")
// Custom Filter , The second column is greater than or equal to the value of the 100
filter.Filter(1, ">=100");
// refresh data
filter.Refresh();
  1. Please review the following code to learn how to set conditional formatting for a cell area in an Excel file.
// Get cells with worksheet.
cells ,_ := worksheet.GetCells()
// Get the format conditions with cells.
formatConditions,_ = cells.GetFormatConditions()
// Add a conditional formatting, return index.
index,_ = formatConditions.Add()
// Get a conditional formatting with format condition index.
condition,_ = formatConditions.Get(index)
// Set Conditional Formatting Rules
// Set Conditional Formatting Formula
condition.SetFormula1_String("=B2>1000")
// Set Conditional Formatting Operator
condition.SetOperator(OperatorType_GreaterThan)
// Set Formatting Style
// Create a new style
style,_ := workbook.CreateStyle();
// Get the font of style
font,_ := style.GetFont()
// Get the red color
red_color, _ := Color_Red()
// Set the font color to red color
font.SetColor(red_color)
// Set the font bold
font.SetIsBold(true)
// Set the style to the conditional formatting
condition.SetStyle(style)

3. Advanced Data Analysis

  • Pivot Table

    A pivot table performs multidimensional summarization of raw data to quickly gain insights into trends, comparisons, and distributions. Example: Sales data is summarized by region, product category, and quarter to analyze which product performs best in which area.

  • Formula

    Embed dynamic formulas in Excel to make reports automatically update (e.g., Profit Margin = Profit / Sales). Example: Add a “Gross Margin” column in a summary table with the formula (Revenue - Cost) / Revenue, which recalculates automatically when the original data is updated.

  • Charts

    Charts visualize data, making it easier to quickly identify patterns, anomalies, and trends. Example: A bar chart showing sales by region, or a time series line chart of product sales.

  1. Please review the following code to learn how to use a pivot table to show data in an Excel file.
// Get pivot table container for worksheet.
pivotTables,_ := worksheet.GetPivotTables()
// Create a pivot table, return index.
index,_ := pivotTables.Add_String_String_String("=A1:D100", "E3", "PivotTable1")
// Get a pivot table with index
pivotTable,_ := pivotTables.Get_Int(index);

// Configure PivotTable Fields for a pivot table.
// Add row field.
pivotTable.AddFieldToArea_PivotFieldType_Int(PivotFieldType_Row, 0)
// Add column field.
pivotTable.AddFieldToArea_PivotFieldType_Int(PivotFieldType_Column, 1)
// Add data field.
pivotTable.AddFieldToArea_PivotFieldType_Int(PivotFieldType_Data, 3)
// Set data summary method
dataFields,_ := pivotTable.GetDataFields()
dataField, _ := dataFields.Get_Int(0)
dataField.SetFunction(ConsolidationFunction_Sum);

pivotTable.CalculateData();
  1. Please review the following code to learn how to use formula calculation to show data in an Excel file.
// Get cells with worksheet.
cells, := worksheet.GetCells()
// Get cell E2.
cell, _ := cells.Get_String("E2")
// Set formula
cell.setFormula("=SUM(B2:D2)")
// calculation all formulas in spreadsheet
workbook.calculateFormula();
// Get result of calculating formula
cells ,_ = worksheet.GetCells()
cell,_ cells.Get_String("E2")
result,_ := cell.GetDoubleValue()
  1. Please review the following code to learn how to generate a chart to show data in an Excel file.
// Add a chart
charts,_ := worksheet.GetCharts()
chart_index,_ := charts.Add_ChartType_Int_Int_Int_Int(ChartType_Column, 5, 0, 15, 5)
chart,_ := charts.Get_Int(chartIndex);

// Set Chart Data Area
nseries, _ := chart.GetNSeries()
nseries.Add_String_Bool("=Sheet1!$B$2:$D$10", true)

// Set Category Axis Data
nseries.SetCategoryData("=Sheet1!$A$2:$A$10")

// Set Chart Title
chart_title,_ := chart.GetTitle()
chart_title.SetText("Sales data analysis");

4. Customer Report Generation

You can define the structure and style of the report according to the customer’s needs. Here, we define a simple report style, which includes a data table and its corresponding chart display.