Documentation ¶
Index ¶
- func CellToType(c *xlsx.Cell, outType reflect.Type, params Params) reflect.Value
- func CopyIdenticalFields(copyFrom, copyInto interface{})
- func ExcelFileToSlice(fileName string, sheetName string, model interface{}, params Params) (interface{}, error)
- func GetHeadings(fileName string, sheetName string) ([]string, error)
- func GetSheetNameMap(fileName string) (map[string]int, error)
- func GetSheetNames(fileName string) ([]string, error)
- func WorkbookToSlice(wb *xlsx.File, sheetName string, model interface{}, params Params) (interface{}, error)
- func WorksheetToSlice(sh *xlsx.Sheet, model interface{}, params Params) (interface{}, error)
- type Params
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CellToType ¶
takes an excel cell and converts it to a reflect.Value of a given type (supplied as a reflect.Type) used internally, but exposed as it may have uses elsewhere
func CopyIdenticalFields ¶ added in v0.0.4
func CopyIdenticalFields(copyFrom, copyInto interface{})
copies data from a to b between different structs where the field names are identical eg. where the API fields are a subset of the database fields example usage: api.SomeInterface := some data var models.SomeInterface CopyIdenticalFields()
func ExcelFileToSlice ¶
func GetHeadings ¶
get the first row of a worksheet, whixch is assumed to be the column heading names
func GetSheetNames ¶
func WorkbookToSlice ¶
func WorkbookToSlice(wb *xlsx.File, sheetName string, model interface{}, params Params) (interface{}, error)
allows calling function to keep file open calling function needs to import "github.com/tealeg/xlsx/v3" and pass a pointer to an xlsx.File eg.: wb, err := xlsx.OpenFile(fileName)
func WorksheetToSlice ¶
allows calling function to keep sheet open calling function needs to close the sheet calling function needs to import "github.com/tealeg/xlsx/v3" and pass a pointer to an xlsx.Sheet eg.: sh, ok := wb.Sheet[sheetName]