Categorygithub.com/xenking/xlsx/v3
modulepackage
3.4.6
Repository: https://github.com/xenking/xlsx.git
Documentation: pkg.go.dev

# README

XLSX

Build Status Codecov Code Report Go Reference License

Introduction

xlsx is a library to simplify reading and writing the XML format used by a recent version of Microsoft Excel in Go programs.

Tutorial

If you'd like an introduction to this project try the new tutorial.

Different versions of this project

Prior to v1.0.0

You don't want these versions ;-)

It's hard to remember exactly, but work on this library started within a month of the first public announcement of Go, now more than a decade ago. It was essentially a quick hack to get data out of XLSX files at my workplace. Nobody but me relied on it, so it was fine to use this brand-new language for this task. Somewhat later I decided to share the code, and I know it was well established as an open-source project by the time I left that job in late 2011.

Although I did do some "release" tags, versioning in Go in the early days relied on tagging your code with the name of the Go release (i.e. go1.2) and then go get would fetch that tag, if it existed, and if not, it'd grab the master branch.

Version 1.x.x

Version 1.0.0 was tagged in 2017 to support vendoring tools.

As of October 8th, 2019, I've branched off v1.x.x maintenance work from master. The master branch now tracks v2.x.x.

If you have existing code, can live with the issues in the 1.x.x codebase, and don't want to update your code to use a later version, then you can stick to these releases. I mostly won't be touching this code, but if something really important comes up, let me know.

Version 2.x.x

Version 2.0.0 introduced breaking changes in the API.

The scope of these changes included the way Col elements and DataValidation works, as these aspects have been built around incorrect models of the underlying XLSX format.

See the milestone for details.

Version 2.0.1 was tagged purely because 2.0.0 wasn't handled correctly with regard to how go modules work. It isn't possible to use 2.0.0 from a Go Modules based project.

Version 3.x.x

Version 3.0.0 introduces some more breaking changes in the API. All methods that can return an xlsx.File struct now accept zero, one or many xlsx.FileOption functions as their final arguments. These can be used to modify the behaviour of the resultant struct - in particular they replace the ...WithRowLimit variants of those methods with the result of calling xlsx.RowLimit and they add the ability to define a custom backing store for the spreadsheet data to be held in whilst processing.

StreamFileBuilder has been dropped from this version of the library as it has become difficult to maintain.

Full API docs

The full API docs can be viewed using go's built in documentation tool, or online at pkg.go.dev.

Contributing

We're extremely happy to review pull requests. Please be patient, maintaining XLSX doesn't pay anyone's salary (to my knowledge).

If you'd like to propose a change please ensure the following:

Eat a peach - Geoff

# Functions

ColIndexToLetters is used to convert a zero based, numeric column indentifier into a character code.
ColLettersToIndex is used to convert a character based column reference to a zero based numeric column identifier.
No description provided by the author
This can be use as the default scale function for the autowidth.
No description provided by the author
No description provided by the author
No description provided by the author
A convenient wrapper around File.ToSlice, FileToSlice will return the raw data contained in an Excel XLSX file as three dimensional slice.
FileToSliceUnmerged is a wrapper around File.ToSliceUnmerged.
GetCellIDStringFromCoords returns the Excel format cell name that represents a pair of zero based cartesian coordinates.
GetCellIDStringFromCoordsWithFixed returns the Excel format cell name that represents a pair of zero based cartesian coordinates.
GetCoordsFromCellIDString returns the zero based cartesian coordinates from a cell name in Excel format, e.g.
HSLToRGB converts an HSL triple to a RGB triple.
No description provided by the author
MakeSharedStringRefTable takes an xlsxSST struct and converts it's contents to an slice of strings used to refer to string values by numeric index - this is the model used within XLSX worksheet (a numeric reference is stored to a shared cell value).
No description provided by the author
NewColForRange return a pointer to a new Col, which will apply to columns in the range min to max (inclusive).
NewDataValidation return data validation struct.
NewDiskVCellStoreConstructor is a CellStoreConstructor than returns a CellStore in terms of DiskV.
NewFile creates a new File struct.
No description provided by the author
No description provided by the author
NewMemoryCellStoreConstructor returns a pointer to a newly allocated MemoryCellStore.
NewRedisCellStoreConstructor is a CellStoreConstructor than returns a CellStore in terms of Redis.
NewRichTextColorFromARGB creates a new RichTextColor from ARGB component values.
NewRichTextColorFromThemeColor creates a new RichTextColor from the theme color.
NewRowNotFoundError creates a new RowNotFoundError, capturing the Row key and the reason this key could not be found.
NewSharedStringRefTable creates a new, empty RefTable.
NewSheet constructs a Sheet with the default CellStore and returns a pointer to it.
NewSheetWithCellStore constructs a Sheet, backed by a CellStore, for which you must provide the constructor function.
Return a new Style structure initialised with the default values.
OpenBinary() take bytes of an XLSX file and returns a populated xlsx.File struct for it.
OpenFile will take the name of an XLSX file and returns a populated xlsx.File struct for it.
OpenReaderAt() take io.ReaderAt of an XLSX file and returns a populated xlsx.File struct for it.
ReadZip() takes a pointer to a zip.ReadCloser and returns a xlsx.File struct populated with its contents.
ReadZipReader() can be used to read an XLSX in memory without touching the filesystem.
RGBToHSL converts an RGB triple to a HSL triple.
RowIndexToString is used to convert a zero based, numeric row indentifier into its string representation.
RowLimit will limit the rows handled in any given sheet to the first n, where n is the number of rows.
No description provided by the author
SkipEmptyCells can be passed as an option to Row.ForEachCell in order to make it skip over empty cells in the sheet.
SkipEmptyRows can be passed to the Sheet.ForEachRow function to cause it to skip over empty Rows.
Convert an excelTime representation (stored as a floating point number) to a time.Time.
TimeToExcelTime will convert a time.Time into Excel's float representation, in either 1900 or 1904 mode.
No description provided by the author
UseDiskVCellStore is a FileOption that makes all Sheet instances for a File use DiskV as their backing store.
UseMemoryCellStore is a FileOption that makes all Sheet instances for a File use memory as their backing store.
UseRedisCellStore is a FileOption that makes all Sheet instances for a File use Redis as their backing client.

# Constants

Several popular font names that can be used to create fonts.
Several popular font names that can be used to create fonts.
These are the cell types from the ST_CellType spec.
d (Date): Cell contains a date in the ISO 8601 format.
These are the cell types from the ST_CellType spec.
CellTypeInline is not respected on save, all inline string cells will be saved as SharedStrings when saving to an XLSX file.
These are the cell types from the ST_CellType spec.
These are the cell types from the ST_CellType spec.
CellTypeStringFormula is a specific format for formulas that return string values.
Default column width in excel.
Several popular font names that can be used to create fonts.
Data validation operators.
Data validation operators.
Data validation operators.
Data validation operators.
Data validation operators.
Data validation operators.
Data validation operators.
Data validation operators.
Data validation types.
Data validation types.
Data validation types.
Data validation types.
Data validation types.
DataValidationTypeWhole Integer.
No description provided by the author
No description provided by the author
No description provided by the author
Several popular font names that can be used to create fonts.
Group Separator.
Several popular font names that can be used to create fonts.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RichTextCharsetUnspecified indicates that the font charset was not specified.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RichTextFontFamilyUnspecified indicates that the font family was not specified.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Record Separator.
No description provided by the author
Data validation error styles.
Data validation error styles.
Data validation error styles.
Several popular font names that can be used to create fonts.
No description provided by the author
Unit Separator.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
HSLModel converts any color.Color to a HSL color.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
Border is a high level structure intended to provide user access to the contents of Border Style within an Sheet.
Cell is a high level structure intended to provide user access to the contents of Cell within an xlsx.Row.
No description provided by the author
ColStore is the working store of Col definitions, it will simplify all Cols added to it, to ensure there ar no overlapping definitions.
No description provided by the author
DateTimeOptions are additional options for exporting times.
DiskVCellStore is an implementation of the CellStore interface, backed by DiskV.
No description provided by the author
No description provided by the author
File is a high level structure providing a slice of Sheet structs to the user.
Fill is a high level structure intended to provide user access to the contents of background and foreground color index within an Sheet.
No description provided by the author
HSL represents a cylindrical coordinate of points in an RGB color model.
Hyperlink is a structure to store link information in-workbook links to cells or defined names are stored in Location external links are stores in Link.
MemoryCellStore is the default CellStore - it holds all rows and cells in system memory.
No description provided by the author
No description provided by the author
RedisCellStore is an implementation of the CellStore interface, backed by Redis.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RichTextColor is the color of the RichTextRun.
RichTextFont is the font spec of the RichTextRun.
RichTextRun is a run of the decorated text.
Row represents a single Row in the current Sheet.
RowNotFoundError is an Error that should be returned by a RowStore implementation if a call to ReadRow is made with a key that doesn't correspond to any persisted Row.
Sheet is a high level structure intended to provide user access to the contents of a particular sheet within an XLSX file.
No description provided by the author
No description provided by the author
Style is a high level structure intended to provide user access to the contents of Style within an XLSX file.
XLSXReaderError is the standard error type for otherwise undefined errors in the XSLX reading process.

# Interfaces

CellInterface defines the public API of the Cell.
CellStore provides an interface for interacting with backend cell storage.
CellStoreRow is the interface used to interact with the currently loaded Row from the CellStore.
XLSXUnmarshaler is the interface implemented for types that can unmarshal a Rowas a representation of themselves.

# Type aliases

CellStoreConstructor defines the signature of a function that will be used to return a new instance of the CellStore implementation, you must pass this into.
CellType is an int type for storing metadata about the data type in the cell.
CellVisitorFunc defines the signature of a function that will be called when visiting a Cell using CellStore.ForEachInRow.
CellVisitorOption describes a function that can set values in a cellVisitorFlags struct to affect the way ForEachCell operates.
No description provided by the author
DataValidationOperator operator enum.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
A RowVisitor function should be provided by the user when calling Sheet.ForEachRow, it will be called once for every Row visited.
RowVisitorOption defines the call signature of functions that can be passed as options to the Sheet.ForEachRow function to affect its behaviour.
No description provided by the author