excelize
A pure Go library for reading, writing, and streaming Microsoft Excel spreadsheets, from cell values to charts and pivot tables.
Repository Health
Technical Analysis
Excelize is a pure Go library for creating, reading, and modifying Microsoft Excel spreadsheets in the XLSX, XLSM, XLTM, XLTX, and XLAM formats. It exposes a high-level File API for setting cell values, styles, formulas, charts, pivot tables, and images, and provides a dedicated streaming writer and row iterator for worksheets containing very large amounts of data.
Beyond basic cell manipulation, excelize implements a substantial subset of Excel’s formula-calculation engine, along with data validation, conditional formatting, sparklines, slicers, and VBA project handling — making it suitable for both simple report generation and more complex spreadsheet tooling that would otherwise require shelling out to Excel or LibreOffice.
What You Get
- A full cell-level API for reading and writing values, formulas, styles, and comments across worksheets
- A streaming writer and reader for handling worksheets with hundreds of thousands of rows efficiently
- Built-in chart, pivot table, sparkline, and slicer generation
- A formula calculation engine covering a large portion of Excel’s built-in function library
- Support for images, VBA projects, and workbook encryption/decryption
Common Use Cases
- Generating downloadable Excel reports from backend Go services
- Bulk importing and exporting large datasets to and from XLSX files via the streaming API
- Populating spreadsheet templates with dynamic charts and pivot tables for recurring reports
- Parsing and evaluating formulas in user-uploaded spreadsheets
Under The Hood
Architecture
Excelize centers on a single File struct (excelize.go) that holds the in-memory representation of a workbook: parsed XML parts (WorkBook, Styles, SharedStrings, Comments, Drawings), a sync.Mutex for exclusive operations plus several sync.Map fields (Sheet, Pkg, Relationships, checked, calcCache) that let concurrent goroutines safely read and mutate independent worksheets — verified by an explicit TestConcurrency test that hammers SetCellValue/GetCellValue/SetSheetRow from multiple goroutines. Functionality is split across dozens of flat top-level files by concern rather than nested packages (cell.go, styles.go, chart.go, pivotTable.go, calc.go, drawing.go, crypt.go), each operating on the same File receiver; XML marshaling structs live in separate xml*.go files, decoupling the public API surface from the underlying OOXML schema. Reading and writing both funnel through archive/zip (with a pluggable ZipWriter interface for custom archive backends), so the same File model serves the streaming writer (stream.go), the calculation engine (calc.go), and standard save/open paths.
Tech Stack
Written in pure Go (module github.com/xuri/excelize/v2, requiring Go 1.25+) with a deliberately small dependency surface: golang.org/x/net, golang.org/x/image, and golang.org/x/text for encoding/image support, github.com/richardlehane/mscfb and msoleps for legacy OLE/compound-file parsing (VBA projects), github.com/xuri/efp for formula tokenizing, github.com/xuri/nfp for number-format parsing, and github.com/tiendc/go-deepcopy for struct cloning. testify is the only test dependency. There is no ORM, web framework, or database layer — the library’s only I/O surface is the filesystem and in-memory ZIP archives, and its CI matrix (GitHub Actions) builds and tests across Linux, macOS, Windows, and multiple CPU architectures (ARM, RISC-V) on three upcoming Go versions.
Code Quality
The project has extensive test coverage — 31 _test.go files with roughly 430 top-level test functions, generally one per exported API, using table-driven cases with testify/assert and fixture XLSX files under test/. Error handling is explicit and typed: errors.go defines dozens of named sentinel errors (ErrCellCharsLength, ErrColumnNumber, ErrDefinedNameDuplicate, …) returned directly from API functions rather than panics or swallowed errors, and most public methods return (value, error) pairs consistent with idiomatic Go. CI runs go vet and cross-compiles for multiple architectures on every push. Code coverage is tracked via Codecov, and naming follows Go conventions (exported CamelCase, doc comments on every exported symbol).
What Makes It Unique
Unlike most spreadsheet libraries that only handle cell values and basic formatting, excelize reimplements a working subset of Excel’s own formula engine (CalcCellValue in calc.go, hundreds of built-in functions) entirely in Go, letting consumers evaluate spreadsheet formulas without Excel, LibreOffice, or a headless browser. It also goes deep into OOXML features that competing libraries typically skip — pivot tables, slicers, sparklines, VBA project attachment/extraction, and workbook encryption/decryption — while still offering a streaming writer for very large datasets, combining breadth of Excel-format fidelity with memory-conscious APIs in one dependency-light package.
Used by 5 apps in this directory
BillionMail
Marketing
Self-hosted email server and marketing platform that gives you unlimited sending, full deliverability control, and AI-assisted campaigns without monthly fees.
Bytebase
Devops
An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.
ezBookkeeping
Invoicing Finance
Lightweight self-hosted personal finance manager with AI receipt scanning, multi-currency support, and MCP integration for complete data privacy.
Rill
Analytics · Data Engineering
The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.
shaper
Analytics · Data Engineering
Build analytics dashboards, reports, and customer-facing analytics by writing pure SQL — powered by DuckDB and designed for self-hosted deployment.