Skip to content

jpoz/werkbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

770 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Werkbook

Go Go Reference Go Report Card Latest Release Go Version

A Go library for reading, writing and calculating spreadsheets (.xlsx) with a built-in formula engine. Zero external dependencies.

Install

Library

go get github.com/jpoz/werkbook

CLI

go install github.com/jpoz/werkbook/cmd/wb@latest

This 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 functions

Default 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.

Quick Start

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)
    }
}

Reading Files

wb, err := werkbook.Open("input.xlsx")
if err != nil {
    log.Fatal(err)
}

sheet := wb.Sheet("Sheet1")
v, _ := sheet.GetValue("A1")
fmt.Println(v)

Formula Engine

Werkbook includes a built-in formula engine. See FORMULAS.md for the current list of supported and unsupported functions.

License

MIT

About

A Go library for reading, writing and calculating spreadsheets (XLSX) with a built-in formula engine. Zero external dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages