Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCSVFilenamePattern ¶ added in v0.9.7
Types ¶
type CSVImporter ¶
CSVImporter recognizes pattern: "<BookName>#<SheetName>.csv"
func NewCSVImporter ¶
func NewCSVImporter(filename string, sheetNames []string, parser book.SheetParser) (*CSVImporter, error)
type ExcelImporter ¶
func NewExcelImporter ¶
func NewExcelImporter(filename string, sheetNames []string, parser book.SheetParser, topN uint) (*ExcelImporter, error)
topN: 0 means read all rows
type Importer ¶
type Importer interface {
// Filename returns the parsed filename of the original inputed filename.
// - Excel: same as the inputed filename.
// - CSV: recognizes pattern: "<BookName>#<SheetName>.csv", and returns Glob name "<BookName>#*.csv".
// - XML: same as the inputed filename.
Filename() string
// Bookname returns the book name after parsing the original inputed filename.
// - Excel: the base filename without file extension.
// - CSV: recognizes pattern: "<BookName>#<SheetName>.csv", and returns "<BookName>".
// - XML: the base filename without file extension.
BookName() string
// GetSheets returns all sheets in order of the book.
GetSheets() []*book.Sheet
// GetSheet returns a Sheet of the specified sheet name.
GetSheet(name string) *book.Sheet
}
type Option ¶
type Option func(*Options)
Option is the functional option type.
func Parser ¶
func Parser(parser book.SheetParser) Option
type Options ¶
type Options struct {
Sheets []string // sheet names to import
Parser book.SheetParser // parser to parse the worksheet
TopN uint // read top N rows, 0 means read all rows
}
type XMLImporter ¶
type XMLImporter struct {
// contains filtered or unexported fields
}
func NewXMLImporter ¶
func NewXMLImporter(filename string, sheets []string) (*XMLImporter, error)
TODO: options
func (*XMLImporter) BookName ¶ added in v0.9.7
func (x *XMLImporter) BookName() string
func (*XMLImporter) Filename ¶ added in v0.9.7
func (x *XMLImporter) Filename() string
func (*XMLImporter) GetSheet ¶
func (x *XMLImporter) GetSheet(name string) *book.Sheet
GetSheet returns a Sheet of the specified sheet name.
func (*XMLImporter) GetSheets ¶
func (x *XMLImporter) GetSheets() []*book.Sheet
Click to show internal directories.
Click to hide internal directories.