xlsx

package module
v0.0.0-...-11a7811 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2019 License: MIT Imports: 12 Imported by: 0

README

xlsx GoDoc Go Report Card

Lets you create XLSX files incrementally, writing them to disk in order to avoid high memory usage.

Usage

For now check the test files, specially the usage_test.go.

TODO

  • Write documentation regarding the usage and adding a few examples as well

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Key   string
	Value interface{}
	// contains filtered or unexported fields
}

Cell represents a cell in a worksheet. A row has a collection of cells.

type CellOptions

type CellOptions struct {
	Key   *string
	Value interface{}
}

CellOptions has options used when creating a new cell.

type Row

type Row struct {
	// contains filtered or unexported fields
}

Row represents a row in a worksheet. A worksheet has a collection of rows.

func (*Row) AddCell

func (r *Row) AddCell() (*Cell, error)

AddCell adds a new cell to the row.

func (*Row) AddCellWithKey

func (r *Row) AddCellWithKey(key string) (*Cell, error)

AddCellWithKey is just like AddCell but adds a key to the cell. Should be used if columns were defined on the worksheet.

type Workbook

type Workbook struct {
	FilePath string
	// contains filtered or unexported fields
}

Workbook represents a spreadsheet workbook.

func NewWorkbook

func NewWorkbook(filePath string) *Workbook

NewWorkbook creates a new workbook, which is the base for every XLSX file.

func (*Workbook) AddWorksheet

func (wb *Workbook) AddWorksheet(opts *WorksheetOptions) *Worksheet

AddWorksheet adds a new worksheet to the workbook.

func (*Workbook) Commit

func (wb *Workbook) Commit() error

Commit commits the workbook persisting the data to the specified file.

func (*Workbook) HasPendingWorksheets

func (wb *Workbook) HasPendingWorksheets() bool

HasPendingWorksheets indicates whether or not the workbook has worksheets yet to be committed.

type Worksheet

type Worksheet struct {
	// contains filtered or unexported fields
}

Worksheet represents a worksheet in a workbook.

func (*Worksheet) AddRow

func (ws *Worksheet) AddRow() (*Row, error)

AddRow adds a new row to the worksheet.

func (*Worksheet) Commit

func (ws *Worksheet) Commit() error

Commit commits the worksheet.

func (*Worksheet) CommitRows

func (ws *Worksheet) CommitRows() error

CommitRows commits rows stored in memory.

func (*Worksheet) DefineColumns

func (ws *Worksheet) DefineColumns(columns []*WorksheetColumn) error

DefineColumns defines the worksheet columns. It's optional.

type WorksheetColumn

type WorksheetColumn struct {
	Key   string
	Value string
}

WorksheetColumn represents a column in a worksheet.

type WorksheetOptions

type WorksheetOptions struct {
	Name string
}

WorksheetOptions has options used when creating a new worksheet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL