Quickstart
Quickstart
This walkthrough creates a workbook, writes a small table of values, applies a bold header style, and saves the result — the fastest path from installation to a real .xlsx file.
Prerequisites
| Requirement | Detail |
|---|---|
| Module installed | See Installation |
| Import | import cells_foss "github.com/aspose-cells-foss/Aspose.Cells-FOSS-for-Go/v26/aspose/cells_foss" |
Step 1: Create a workbook and access the first worksheet
A new Workbook always starts with one worksheet, available through the Worksheets slice:
wb := cells_foss.NewWorkbook()
ws := wb.Worksheets[0]
fmt.Println("Worksheets available:", len(wb.Worksheets))
_ = wsStep 2: Write cell values
Use Cells().Set(ref, value) to write a value to a cell by its A1-style reference:
wb := cells_foss.NewWorkbook()
ws := wb.Worksheets[0]
ws.Cells().Set("A1", "Product")
ws.Cells().Set("B1", "Revenue")
ws.Cells().Set("A2", "Widget A")
ws.Cells().Set("B2", 42000)Step 3: Bold the header row
Build a Style with a bold Font and apply it to the header cells with Cell.SetStyle:
wb := cells_foss.NewWorkbook()
ws := wb.Worksheets[0]
ws.Cells().Set("A1", "Product")
ws.Cells().Set("B1", "Revenue")
boldStyle := cells_foss.NewStyle()
boldStyle.Font.Bold = true
for _, ref := range []string{"A1", "B1"} {
cell, _ := ws.Cells().Get(ref)
cell.SetStyle(boldStyle)
}Step 4: Save the workbook
wb := cells_foss.NewWorkbook()
if err := wb.Save("report.xlsx"); err != nil {
fmt.Printf("Error saving workbook: %v\n", err)
return
}
fmt.Println("Workbook saved to report.xlsx")Open report.xlsx in Excel or LibreOffice to see the bold header row and the two data cells.
Next Steps
- Developer Guide: Styling, data validation, tables, pictures, and streaming reads
- API Reference: Full class and method documentation
- Knowledge Base: Task-oriented how-to guides