tablescanner

package module
v0.0.0-...-8cdfab5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

README

golang-tablescanner

XLSX simple table parser

Tests: under construction

Future features: xls/csv support

Great thanks to github/tealeg for xml basis and all about formatting cell values from his xlsx repository.

Thanks to github/Extrame for his xls reader package

I just wanted to read huge xlsx files fast with small memory and CPU usage for my work.

Documentation

Index

Constants

View Source
const (
	MJD_0 = float64(2400000.5)
)

Variables

This section is empty.

Functions

func DetectExcelContentType

func DetectExcelContentType(fileName string) (err error, bookType TExcelWorkbookType, textEncoding TTextEnconding, BOMPresent []byte)

func TimeFromExcelTime

func TimeFromExcelTime(excelTime float64, date1904 bool) time.Time

Convert an excelTime representation (stored as a floating point number) to a time.Time.

func UTF16BytesToUTF8Bytes

func UTF16BytesToUTF8Bytes(b []byte, o binary.ByteOrder) []byte

Types

type IExcelFormatter

type IExcelFormatter interface {
	DisableFormatting()
	EnableFormatting()
	AllowScientific()
	DenyScientific()
	SetDateFixedFormat(value string)
	SetDecimalSeparator(value string)
	SetThousandSeparator(value string)
	SetTrimOn()
	SetTrimOff()
	FormatValue(cellValue string, cellType string, fullFormat *parsedNumberFormat) (string, error)
}

type ITableDocumentScanner

type ITableDocumentScanner interface {
	io.Closer
	FormatterAvailable() bool
	SetI18n(string) error
	Formatter() IExcelFormatter
	GetSheets() []ITableSheetInfo
	GetCurrentSheetId() int
	SetSheetId(id int) error
	Scan() error
	GetLastScanError() error
	GetScanned() []string
}

func NewTableStream

func NewTableStream(fileName string) (error, ITableDocumentScanner)

func NewXLSStream

func NewXLSStream(fileName string) (error, ITableDocumentScanner)

func NewXLSXStream

func NewXLSXStream(fileName string) (error, ITableDocumentScanner)

type ITableSheetInfo

type ITableSheetInfo interface {
	GetName() string
	GetHideLevel() TSheetHideLevel
}

type ReadSeekCloser

type ReadSeekCloser interface {
	io.ReadCloser
	io.Seeker
}

type TExcelWorkbookType

type TExcelWorkbookType byte
const (
	TypeExcelWorkbookUnknown    TExcelWorkbookType = 0
	TypeExcelWorkbookXLSX       TExcelWorkbookType = 1
	TypeExcelWorkbookXLS        TExcelWorkbookType = 2
	TypeExcelWorkbookXML        TExcelWorkbookType = 3
	TypeExcelWorkbookSingleHTML TExcelWorkbookType = 4
)

type TSheetHideLevel

type TSheetHideLevel byte
const (
	TableSheetVisible    TSheetHideLevel = 0
	TableSheetHidden     TSheetHideLevel = 1
	TableSheetVeryHidden TSheetHideLevel = 2
)

type TTextEnconding

type TTextEnconding byte
const (
	EncodingUnknown TTextEnconding = 0
	EncodingUTF8    TTextEnconding = 1
	EncodingUTF16BE TTextEnconding = 2
	EncodingUTF16LE TTextEnconding = 3
)

Jump to

Keyboard shortcuts

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