Documentation
¶
Index ¶
- Constants
- func GenAxis(length int) []string
- func GetAxisName(col int) string
- func GetColNum(axis string) int
- func LoadExcel(filePath string) (excel *excelize.File, err error)
- func LoadExcels(path string) (excels []*excelize.File, err error)
- func ParseAxis(axis string) (cellIndex int, rowIndex int, err error)
- type ExcelProxy
- func (ep *ExcelProxy) GetSheet(sheet string) (es *ExcelSheet, err error)
- func (ep *ExcelProxy) LoadExcel(excelPath string, overwrite bool) error
- func (ep *ExcelProxy) LoadExcels(excelPath string, overwrite bool) error
- func (ep *ExcelProxy) LoadSheets(sheetPrefix string, colNickRow int, overwrite bool) error
- func (ep *ExcelProxy) MergedRows(startRow int) (err error)
- func (ep *ExcelProxy) MergedRowsByFilter(startRow int, filter func(row *ExcelRow) bool) (err error)
- func (ep *ExcelProxy) ValueAtAxis(sheet string, axis string) (value string, err error)
- type ExcelRow
- func (er *ExcelRow) Axis() []string
- func (er *ExcelRow) AxisLength() int
- func (er *ExcelRow) CellLength() int
- func (er *ExcelRow) Empty() bool
- func (er *ExcelRow) Nick() []string
- func (er *ExcelRow) NickLength() int
- func (er *ExcelRow) String() string
- func (er *ExcelRow) ValueAtAxis(axis string) (value string, err error)
- func (er *ExcelRow) ValueAtIndex(index int) (value string, err error)
- func (er *ExcelRow) ValueAtNick(nick string) (value string, err error)
- type ExcelSheet
- func (es *ExcelSheet) AxisLength() int
- func (es *ExcelSheet) GetRowAt(rowIndex int) (row *ExcelRow)
- func (es *ExcelSheet) GetRowsBetween(startIndex int, endIndex int) (rows []*ExcelRow)
- func (es *ExcelSheet) GetRowsByFilter(startIndex int, filter func(row *ExcelRow) bool) (rows []*ExcelRow)
- func (es *ExcelSheet) GetRowsFrom(startIndex int) (rows []*ExcelRow)
- func (es *ExcelSheet) NickLength() int
- func (es *ExcelSheet) SetNick(nick []string)
- func (es *ExcelSheet) String() string
- func (es *ExcelSheet) ValueAtAxis(axis string) (value string, err error)
Constants ¶
const ( ExtXls = "xls" ExtXlsx = "xlsx" )
Variables ¶
This section is empty.
Functions ¶
func LoadExcels ¶
加载路径下的Excel文件,多个路径用","分割 支持文件夹路径
Types ¶
type ExcelProxy ¶
type ExcelProxy struct {
Excels []*excelize.File
Sheets []*ExcelSheet
DataRows []*ExcelRow
}
func (*ExcelProxy) GetSheet ¶
func (ep *ExcelProxy) GetSheet(sheet string) (es *ExcelSheet, err error)
func (*ExcelProxy) LoadExcel ¶
func (ep *ExcelProxy) LoadExcel(excelPath string, overwrite bool) error
加载excelPath指定的一个或多个Excel文件。 excelPath支持多路径模式,用","分隔。 excelPath支持文件夹,不支持递归。
func (*ExcelProxy) LoadExcels ¶
func (ep *ExcelProxy) LoadExcels(excelPath string, overwrite bool) error
加载excelPath指定的一个Excel文件。
func (*ExcelProxy) LoadSheets ¶
func (ep *ExcelProxy) LoadSheets(sheetPrefix string, colNickRow int, overwrite bool) error
从已经加载好的Excel中加载Sheets sheetPrefix用于限制
func (*ExcelProxy) MergedRows ¶
func (ep *ExcelProxy) MergedRows(startRow int) (err error)
合并全部sheet的行数据。 从StartRow开始。 清除空数据
func (*ExcelProxy) MergedRowsByFilter ¶
func (ep *ExcelProxy) MergedRowsByFilter(startRow int, filter func(row *ExcelRow) bool) (err error)
合并全部sheet的行数据。 从StartRow开始。 清除空数据
func (*ExcelProxy) ValueAtAxis ¶
func (ep *ExcelProxy) ValueAtAxis(sheet string, axis string) (value string, err error)
Open to templates 通过Sheet的名称和坐标取值,坐标格式:B4
type ExcelRow ¶
type ExcelRow struct {
Cell []string
Index int
Sheet *ExcelSheet
}
func (*ExcelRow) AxisLength ¶
func (*ExcelRow) CellLength ¶
func (*ExcelRow) NickLength ¶
func (*ExcelRow) ValueAtAxis ¶
Open to templates 通过列名取值
func (*ExcelRow) ValueAtIndex ¶
Open to templates 通过索引号取值,索引号从0开始
type ExcelSheet ¶
type ExcelSheet struct {
SheetIndex int // Sheet的索引
SheetName string // Sheet的名称
Axis []string // 列名
Nick []string // 列别名
RowLength int // 行数
Rows []*ExcelRow // 全部行内容
}
func LoadSheets ¶
func LoadSheets(excelFile *excelize.File, sheetPrefix string, nickRow int) (sheets []*ExcelSheet, err error)
通过SheetPrefix作为限制加载Sheet, 使用""代表不限制 指定NickRow所在行为别名,NickRow=0时,使用列号作为别名
func (*ExcelSheet) AxisLength ¶
func (es *ExcelSheet) AxisLength() int
func (*ExcelSheet) GetRowAt ¶
func (es *ExcelSheet) GetRowAt(rowIndex int) (row *ExcelRow)
func (*ExcelSheet) GetRowsBetween ¶
func (es *ExcelSheet) GetRowsBetween(startIndex int, endIndex int) (rows []*ExcelRow)
func (*ExcelSheet) GetRowsByFilter ¶
func (es *ExcelSheet) GetRowsByFilter(startIndex int, filter func(row *ExcelRow) bool) (rows []*ExcelRow)
func (*ExcelSheet) GetRowsFrom ¶
func (es *ExcelSheet) GetRowsFrom(startIndex int) (rows []*ExcelRow)
func (*ExcelSheet) NickLength ¶
func (es *ExcelSheet) NickLength() int
func (*ExcelSheet) SetNick ¶
func (es *ExcelSheet) SetNick(nick []string)
func (*ExcelSheet) String ¶
func (es *ExcelSheet) String() string
func (*ExcelSheet) ValueAtAxis ¶
func (es *ExcelSheet) ValueAtAxis(axis string) (value string, err error)
Open to templates 通过坐标取值,坐标格式:B4