Documentation ¶
Overview ¶
Package spreadsheet provides simple a interface to read spreadsheet files including XLSX and CSV.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct {
// contains filtered or unexported fields
}
Cell holds a single piece of data in a spreadsheet.
func (*Cell) Float ¶
Float returns the cell data as a float. If the cell data is not a numeric value, an error is returned.
func (*Cell) Int ¶
Int returns the cell data as an int. If the cell data is not a numeric value, an error is returned.
func (*Cell) Int64 ¶
Int64 returns the cell data as an int64. If the cell data is not a numeric value, an error is returned.
func (*Cell) Is ¶
func (c *Cell) Is(t CellDataType) bool
Is returns true if data type of cell c is the same with the given type t.
type CellDataType ¶
type CellDataType uint8
CellDataType represents the primitive data type in spreadsheet cells.
const ( String CellDataType = iota Numeric Bool )
CellDataType constants.
func (CellDataType) Name ¶
func (t CellDataType) Name() string
Name returns name of cell data type t.
type Row ¶
type Row struct {
Cells []*Cell
}
Row is a single row of data in a spreadsheet, containing multiple cells.
type Spreadsheet ¶
type Spreadsheet struct { Sheets []*Sheet // For CSV there's only 1 sheet, named "Sheet 1". SheetsByName map[string]*Sheet }
Spreadsheet is a high-level interface for spreadsheet files including XLSX, XLS and CSV. A Spreadsheet contains one or more sheets of data.
func Open ¶
func Open(filePath string) (*Spreadsheet, error)
Open opens a spreadsheet file. filePath is the path to the spreadsheet file to be opened. Supported file types are XLSX and CSV (as described in RFC 4180). A Spreadsheet pointer will be returned if successful. Otherwise, a nil pointer will be returned with an error indicating what is wrong.