Documentation ¶
Overview ¶
Package spreadsheet for interacting with spreadsheets
Package spreadsheet for interacting with spreadsheets
Index ¶
- func A1FormatToRowColumn(a1 string) (row, column int, err error)
- func AutoFormat(xlsxfile *xlsx.File)
- func Column(sheet *xlsx.Sheet, column int) (cells []*xlsx.Cell, err error)
- func ConvertMinMaxtoArray(minmax []string) (array []string, err error)
- func GetDataFromCell(sheet *xlsx.Sheet, cellPositionInA1Format string) (cell *xlsx.Cell, err error)
- func GetDataFromCells(sheet *xlsx.Sheet, cellcoords []string) (cells []*xlsx.Cell, err error)
- func GetDataFromRowCol(sheet *xlsx.Sheet, col int, row int) (cell *xlsx.Cell, err error)
- func OpenXLSX(xlsx wtype.File) (file *xlsx.File, err error)
- func OpenXLSXBinary(bytes []byte) (file *xlsx.File, err error)
- func OpenXLSXFromFileName(filename string) (file *xlsx.File, err error)
- func Row(sheet *xlsx.Sheet, rowNumber int) (cells []*xlsx.Cell, err error)
- func Sheet(file *xlsx.File, sheetnum int) (sheet *xlsx.Sheet, err error)
- func SheetToCSV(sheet *xlsx.Sheet) (records [][]string)
- func ToHeaderDataMap(sheet *xlsx.Sheet, useHeaderRow int) (headerdatamap map[string][]*xlsx.Cell, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func A1FormatToRowColumn ¶
A1FormatToRowColumn parses an A1 style excel cell coordinate into ints for row and column for use by plotinum library note that 1 is subtracted from the column number in accordance with the go convention of counting from 0
func AutoFormat ¶
AutoFormat applies basic default formatting to a spreadsheet. Column widths will be estimated and set to the estimated width for each column of a sheet. A thick border will be added to the base of the first row of the each sheet.
func ConvertMinMaxtoArray ¶
ConvertMinMaxtoArray converts a pair of cell positions an array of all entries between the pair will be returned (e.g. a1:a12 or a1:e1)
func GetDataFromCell ¶
GetDataFromCell returns the cell contents at the specified cell position in an xlsx sheet. The cellPositionInA1Formatshould be specified according to standard xslx nomenclature. i.e. a letter corresponding to column followed by a number corresponding to row (starting from 1). i.e. the first cell would be A1. An error is returned if no value at the requested well position is found.
func GetDataFromCells ¶
GetDataFromCells returns the cell contents at the specified cell positions in an xlsx sheet. The cellcoords be specified according to standard xslx nomenclature. i.e. a letter corresponding to column followed by a number corresponding to row (starting from 1). i.e. the first cell would be A1. An error is returned if no value at the requested well position is found.
func GetDataFromRowCol ¶
GetDataFromRowCol returns the cell contents at the specified row and column number in an xlsx sheet. An error is returned if the column aor row number specified is beyond the range available in the sheet. Counting starts from zero. i.e. the cell at the first row and first column would be called by cell, err := GetDataFromRowCol(sheet, 0,0)
func OpenXLSXBinary ¶
OpenXLSXBinary parses the contents of an xlsx file into the xlsx.File data structure.
func OpenXLSXFromFileName ¶
OpenXLSXFromFileName will open an xlsx file from a filename.
func Sheet ¶
Sheet returns the xlsx.Sheet in the xlsx file according to the sheet number. An error is returned if an invalid sheet number is specified. The sheet object looks like this:
type Sheet struct { Name string File *File Rows []*Row Cols []*Col MaxRow int MaxCol int Hidden bool Selected bool SheetViews []SheetView SheetFormat SheetFormat AutoFilter *AutoFilter }
func SheetToCSV ¶
SheetToCSV returns a matrix of string values for the contents of each cell in the sheet.
func ToHeaderDataMap ¶
func ToHeaderDataMap(sheet *xlsx.Sheet, useHeaderRow int) (headerdatamap map[string][]*xlsx.Cell, err error)
ToHeaderDataMap returns a map of all column headers with corresponding cells. useHeaderRow corresponds to the row to use for the headers. If this is the first row, it should be set to 0.
Types ¶
This section is empty.