A Go library for reading, writing and calculating spreadsheets (.xlsx) with a built-in formula engine. Zero external dependencies.
go get github.com/jpoz/werkbookgo install github.com/jpoz/werkbook/cmd/wb@latestThis installs the wb (werkbook) binary, which provides commands for reading, editing, and creating XLSX files from the command line:
wb info file.xlsx # Sheet metadata
wb read file.xlsx --range A1:D10 # Read cell data
wb edit file.xlsx --patch '[{"cell":"A1","value":"Hello"}]' # Edit cells
wb create new.xlsx --spec '{"sheets":["Data"]}' # Create workbook
wb calc file.xlsx # Recalculate formulas
wb formula list # List available functionsDefault CLI output is human-readable text. Use --format json or --mode agent for structured JSON, and --format markdown or --format csv for table output where supported.
package main
import (
"fmt"
"log"
"github.com/jpoz/werkbook"
)
func main() {
// Create a new workbook
wb := werkbook.New()
sheet := wb.Sheet("Sheet1")
// Set values
sheet.SetValue("A1", "Sales")
sheet.SetValue("A2", 100)
sheet.SetValue("A3", 200)
sheet.SetValue("A4", 300)
// Set a formula
sheet.SetFormula("A5", "SUM(A2:A4)")
// Read the computed value
v, _ := sheet.GetValue("A5")
fmt.Println(v) // 600
// Save to file
if err := wb.SaveAs("output.xlsx"); err != nil {
log.Fatal(err)
}
}wb, err := werkbook.Open("input.xlsx")
if err != nil {
log.Fatal(err)
}
sheet := wb.Sheet("Sheet1")
v, _ := sheet.GetValue("A1")
fmt.Println(v)Werkbook includes a built-in formula engine. See FORMULAS.md for the current list of supported and unsupported functions.