xlrd2

package module
v0.0.0-...-0de542e Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0, BSD-3-Clause Imports: 18 Imported by: 0

README

xlrd2

xlrd2 is an effort to extend xlrd project, which is no longer mintained by its developers. The main goal is to make it suitable for extracting necessary information from malicious xls documents.

Xlrd Purpose: Provide a library for developers to use to extract data from Microsoft Excel (tm) spreadsheet files. It is not an end-user tool.

Versions of Python supported: 2.7, 3.4+.

Installation:

  1. Installing using pip

     pip install xlrd2
    
  2. Installing the latest development

    Using pip

     pip install -U https://github.com/DissectMalware/xlrd2/archive/master.zip
    

    Or download the latest version

     wget https://github.com/DissectMalware/xlrd2/archive/master.zip
    

    Extract the zip file and go to the extracted directory

     python setup.py install --user
    

Quick start:

import xlrd2
book = xlrd2.open_workbook("myfile.xls")
print("The number of worksheets is {0}".format(book.nsheets))
print("Worksheet name(s): {0}".format(book.sheet_names()))
sh = book.sheet_by_index(0)
print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols))
print("Cell D30 is {0}".format(sh.cell_value(rowx=29, colx=3)))
for rx in range(sh.nrows):
    print(sh.row(rx))

Another quick start: This will show the first, second and last rows of each sheet in each file:

python PYDIR/scripts/runxlrd2.py 3rows *blah*.xls

Xlrd Acknowledgements:

  • This package started life as a translation from C into Python of parts of a utility called "xlreader" developed by David Giffin. "This product includes software developed by David Giffin david@giffin.org."
  • OpenOffice.org has truly excellent documentation of the Microsoft Excel file formats and Compound Document file format, authored by Daniel Rentz. See http://sc.openoffice.org
  • U+5F20 U+654F: over a decade of inspiration, support, and interesting decoding opportunities.
  • Ksenia Marasanova: sample Macintosh and non-Latin1 files, alpha testing
  • Backporting to Python 2.1 was partially funded by Journyx - provider of timesheet and project accounting solutions (http://journyx.com/).
  • Provision of formatting information in version 0.6.1 was funded by Simplistix Ltd (http://www.simplistix.co.uk/)

Documentation

Index

Constants

View Source
const (
	FormatTypeUnknown = iota
	FormatTypeDate
	FormatTypeNumber
	FormatTypeGeneral
	FormatTypeText
)
View Source
const (
	FMLATypeCell    = 1
	FMLATypeShared  = 2
	FMLATypeArray   = 4
	FMLATypeCondFmt = 8
	FMLATypeDataVal = 16
	FMLATypeName    = 32
	AllFMLATypes    = 63
)
View Source
const (
	FMLA_TYPE_CELL     = FMLATypeCell
	FMLA_TYPE_SHARED   = FMLATypeShared
	FMLA_TYPE_ARRAY    = FMLATypeArray
	FMLA_TYPE_COND_FMT = FMLATypeCondFmt
	FMLA_TYPE_DATA_VAL = FMLATypeDataVal
	FMLA_TYPE_NAME     = FMLATypeName
	ALL_FMLA_TYPES     = AllFMLATypes
)
View Source
const (
	OUNK  = 0
	OSTRG = 1
	ONUM  = 2
	OBOOL = 3
	OERR  = 4
	OMSNG = 5
	OARR  = 6
	OREF  = -1
	OREL  = -2
)
View Source
const (
	XLCellEmpty = iota
	XLCellText
	XLCellNumber
	XLCellDate
	XLCellBoolean
	XLCellError
	XLCellBlank
)
View Source
const (
	XL_CELL_EMPTY   = XLCellEmpty
	XL_CELL_TEXT    = XLCellText
	XL_CELL_NUMBER  = XLCellNumber
	XL_CELL_DATE    = XLCellDate
	XL_CELL_BOOLEAN = XLCellBoolean
	XL_CELL_ERROR   = XLCellError
	XL_CELL_BLANK   = XLCellBlank
)
View Source
const BIFFFirstUnicode = 80
View Source
const DATEFORMAT = FDT
View Source
const NUMBERFORMAT = FNU
View Source
const Version = "1.3.4"
View Source
const VersionString = Version

Variables

View Source
var BiffTextFromNum = map[int]string{
	0:  "(not BIFF)",
	20: "2.0",
	21: "2.1",
	30: "3",
	40: "4S",
	45: "4W",
	50: "5",
	70: "7",
	80: "8",
	85: "8X",
}
View Source
var EmptyCell = Cell{Ctype: XLCellEmpty, Value: "", XFIndex: -1}
View Source
var ErrUnsupportedXLS = errors.New("legacy .xls BIFF workbooks are not supported by the Go implementation yet")
View Source
var ErrorTextFromCode = map[int]string{
	0x00: "#NULL!",
	0x07: "#DIV/0!",
	0x0f: "#VALUE!",
	0x17: "#REF!",
	0x1d: "#NAME?",
	0x24: "#NUM!",
	0x2a: "#N/A",
}
View Source
var FMLATypedescrMap = map[int]string{
	FMLATypeCell:    "CELL",
	FMLATypeShared:  "SHARED",
	FMLATypeArray:   "ARRAY",
	FMLATypeCondFmt: "COND-FMT",
	FMLATypeDataVal: "DATA-VAL",
	FMLATypeName:    "NAME",
}
View Source
var OKindDict = map[int]string{
	OREL:  "oREL",
	OREF:  "oREF",
	OUNK:  "oUNK",
	OSTRG: "oSTRG",
	ONUM:  "oNUM",
	OBOOL: "oBOOL",
	OERR:  "oERR",
	OMSNG: "oMSNG",
	OARR:  "oARR",
}

Functions

func AdjustCellAddrBiff8

func AdjustCellAddrBiff8(rowval, colval uint16, reldelta bool) (int, int, bool, bool)

func AdjustCellAddrBiffLE7

func AdjustCellAddrBiffLE7(rowval uint16, colval byte, reldelta bool) (int, int, bool, bool)

func AdjustCellAddrBiffLe7

func AdjustCellAddrBiffLe7(rowval uint16, colval byte, reldelta bool) (int, int, bool, bool)

func BIFFCountRecords

func BIFFCountRecords(stream []byte, writer io.Writer) error

func BIFFDump

func BIFFDump(stream []byte, writer io.Writer, unnumbered bool) error

func BiffRecordName

func BiffRecordName(code uint16) string

func CellNameToRowCol

func CellNameToRowCol(cellName string, allowNoCol bool) (int, int, error)

func Cellname

func Cellname(rowx, colx int) string

func CellnameAbs

func CellnameAbs(rowx, colx int, r1c1 bool) string

func Cellnamerel

func Cellnamerel(rowx, colx int, rowRel, colRel bool, baseRow, baseCol *int, r1c1 bool) string

func Colname

func Colname(colx int) string

func Colnamerel

func Colnamerel(colx int, colRel bool, baseCol *int, r1c1 bool) string

func CountRecords

func CountRecords(filename string, writer io.Writer) error

func DecompileFormula

func DecompileFormula(book *Book, formula []byte, opts FormulaOptions) (string, error)

func DisplayCellAddress

func DisplayCellAddress(rowx, colx int, rowRel, colRel bool) string

func Dump

func Dump(filename string, writer io.Writer, unnumbered bool) error

func DumpFormula

func DumpFormula(book *Book, formula []byte, opts FormulaOptions) (string, error)

func ExpandCellAddress

func ExpandCellAddress(rowx, colx int) (int, int)

func HexCharDump

func HexCharDump(data []byte, offset, length int, writer io.Writer, unnumbered bool) error

func IsCellOpcode

func IsCellOpcode(opcode uint16) bool

func IsDateFormatString

func IsDateFormatString(format string) bool

func NearestColourIndex

func NearestColourIndex(colourMap map[int]*RGB, rgb RGB) int

func Quotedsheetname

func Quotedsheetname(sheetNames []string, sheetIndex int) string

func Rangename2D

func Rangename2D(rlo, rhi, clo, chi int, r1c1 bool) string

func Rangename2DRel

func Rangename2DRel(coords [4]int, relFlags [4]bool, baseRow, baseCol *int, r1c1 bool) string

func Rangename3D

func Rangename3D(book *Book, ref Ref3D) string

func Rangename3DRel

func Rangename3DRel(book *Book, ref Ref3D, rowRel1, rowRel2, colRel1, colRel2 bool) string

func Rownamerel

func Rownamerel(rowx int, rowRel bool, baseRow *int, r1c1 bool) string

func Sheetrange

func Sheetrange(book *Book, slo, shi int) string

func Sheetrangerel

func Sheetrangerel(book *Book, sheetRange [2]int, sheetRangeRel [2]bool) string

func UnpackRk

func UnpackRk(data []byte) float64

func UnpackString

func UnpackString(data []byte, pos int, encoding string, lenLen int) (string, error)

func UnpackStringUpdatePos

func UnpackStringUpdatePos(data []byte, pos int, encoding string, lenLen int, knownLen *int) (string, int, error)

func UnpackUnicode

func UnpackUnicode(data []byte, pos int, lenLen int) (string, error)

func UnpackUnicodeUpdatePos

func UnpackUnicodeUpdatePos(data []byte, pos int, lenLen int, knownLen *int) (string, int, error)

func XLDateAsDateTime

func XLDateAsDateTime(value float64, datemode int) time.Time

func XLDateAsTuple

func XLDateAsTuple(value float64, datemode int) ([6]int, error)

func XLDateFromDateTimeTuple

func XLDateFromDateTimeTuple(dt [6]int, datemode int) (float64, error)

func XLDateFromDateTuple

func XLDateFromDateTuple(date [3]int, datemode int) (float64, error)

func XLDateFromTimeTuple

func XLDateFromTimeTuple(t [3]int) (float64, error)

func XLDateToTime

func XLDateToTime(value float64, datemode int) time.Time

XLDateToTime converts Excel date value to Go time.Time Alias of XLDateAsDateTime for consistent naming

Types

type Book

type Book struct {
	Datemode          int
	BiffVersion       int
	CodePage          int
	Encoding          string
	Countries         [2]int
	Props             map[string]string
	UserName          string
	AddinFuncNames    []string
	NameObjList       []*Name
	NameAndScopeMap   map[NameKey]*Name
	NameMap           map[string][]*Name
	FontList          []Font
	XFList            []*XF
	FormatList        []*Format
	FormatMap         map[int]*Format
	StyleNameMap      map[string]StyleRef
	ColourMap         map[int]*RGB
	ColourIndexesUsed map[int]bool
	PaletteRecord     []RGB
	// contains filtered or unexported fields
}

func OpenWorkbook

func OpenWorkbook(filename string) (*Book, error)

func OpenWorkbookBytes

func OpenWorkbookBytes(data []byte) (*Book, error)

func OpenWorkbookBytesWithOptions

func OpenWorkbookBytesWithOptions(data []byte, options OpenOptions) (*Book, error)

func OpenWorkbookWithOptions

func OpenWorkbookWithOptions(filename string, options OpenOptions) (*Book, error)

func OpenWorkbookXLS

func OpenWorkbookXLS(filename string, options OpenOptions) (*Book, error)

func OpenWorkbookXls

func OpenWorkbookXls(filename string, options OpenOptions) (*Book, error)

func (*Book) AddinFunctions

func (b *Book) AddinFunctions() []string

func (*Book) AllNameKeys

func (b *Book) AllNameKeys() []NameKey

func (*Book) AllSheets

func (b *Book) AllSheets() []*Sheet

func (*Book) BiffVersionText

func (b *Book) BiffVersionText() string

func (*Book) Close

func (b *Book) Close() error

func (*Book) Enter

func (b *Book) Enter() *Book

func (*Book) Exit

func (b *Book) Exit() error

func (*Book) FindName

func (b *Book) FindName(name string) (*Name, bool)

func (*Book) FirstSheet

func (b *Book) FirstSheet() *Sheet

func (*Book) FontCount

func (b *Book) FontCount() int

func (*Book) Fonts

func (b *Book) Fonts() []Font

func (*Book) FormatCount

func (b *Book) FormatCount() int

func (*Book) Formats

func (b *Book) Formats() []*Format

func (*Book) FormattingInfo

func (b *Book) FormattingInfo() bool

func (*Book) GetSheet

func (b *Book) GetSheet(sheetNameOrIndex any) (*Sheet, error)

func (*Book) GetSheets

func (b *Book) GetSheets() []*Sheet

func (*Book) GlobalNames

func (b *Book) GlobalNames() []*Name

func (*Book) HasGlobalName

func (b *Book) HasGlobalName(name string) bool

func (*Book) HasMacroName

func (b *Book) HasMacroName(name string) bool

func (*Book) HasName

func (b *Book) HasName(name string) bool

func (*Book) HasSheet

func (b *Book) HasSheet(name string) bool

func (*Book) HasSheets

func (b *Book) HasSheets() bool

func (*Book) HiddenSheets

func (b *Book) HiddenSheets() []*Sheet

func (*Book) IgnoreWorkbookCorruption

func (b *Book) IgnoreWorkbookCorruption() bool

func (*Book) IsEmpty

func (b *Book) IsEmpty() bool

func (*Book) Item

func (b *Book) Item(item any) (*Sheet, error)

func (*Book) IterNames

func (b *Book) IterNames() <-chan *Name

func (*Book) IterSheets

func (b *Book) IterSheets() <-chan *Sheet

func (*Book) LastSheet

func (b *Book) LastSheet() *Sheet

func (*Book) LoadTimeStage1

func (b *Book) LoadTimeStage1() float64

func (*Book) LoadTimeStage2

func (b *Book) LoadTimeStage2() float64

func (*Book) MacroNames

func (b *Book) MacroNames() []*Name

func (*Book) NSheets

func (b *Book) NSheets() int

func (*Book) Name

func (b *Book) Name(name string) []*Name

func (*Book) NameAndScopeMapView

func (b *Book) NameAndScopeMapView() map[NameKey]*Name

func (*Book) NameDetails

func (b *Book) NameDetails(name string) []*Name

func (*Book) NameDetailsInScope

func (b *Book) NameDetailsInScope(name string, scope any) (*Name, int, bool, error)

func (*Book) NameInScope

func (b *Book) NameInScope(name string, scope int) (*Name, bool)

func (*Book) NameMapView

func (b *Book) NameMapView() map[string][]*Name

func (*Book) NameObjListView

func (b *Book) NameObjListView() []*Name

func (*Book) NameVisible

func (b *Book) NameVisible(name string, scope int) (*Name, bool)

func (*Book) NameVisibleInScope

func (b *Book) NameVisibleInScope(name string, scope any) (*Name, int, bool, error)

func (*Book) Names

func (b *Book) Names() []*Name

func (*Book) NamesInScope

func (b *Book) NamesInScope(scope int) []*Name

func (*Book) NumNames

func (b *Book) NumNames() int

func (*Book) OnDemand

func (b *Book) OnDemand() bool

func (*Book) PropsView

func (b *Book) PropsView() map[string]string

func (*Book) QueryNamesInScope

func (b *Book) QueryNamesInScope(scope any) ([]*Name, error)

func (*Book) RaggedRows

func (b *Book) RaggedRows() bool

func (*Book) ReleaseResources

func (b *Book) ReleaseResources()

func (*Book) ResolveScope

func (b *Book) ResolveScope(scope any) (int, error)

func (*Book) ResourcesReleased

func (b *Book) ResourcesReleased() bool

func (*Book) ScopeAsString

func (b *Book) ScopeAsString(scope int) string

func (*Book) SheetByIndex

func (b *Book) SheetByIndex(index int) (*Sheet, error)

func (*Book) SheetByName

func (b *Book) SheetByName(name string) (*Sheet, error)

func (*Book) SheetIndexByName

func (b *Book) SheetIndexByName(name string) (int, error)

func (*Book) SheetLoaded

func (b *Book) SheetLoaded(sheetNameOrIndex any) bool

func (*Book) SheetNames

func (b *Book) SheetNames() []string

func (*Book) SheetNumbers

func (b *Book) SheetNumbers() []int

func (*Book) SheetOrNil

func (b *Book) SheetOrNil(sheetNameOrIndex any) *Sheet

func (*Book) Sheets

func (b *Book) Sheets() []*Sheet

func (*Book) SheetsList

func (b *Book) SheetsList() []*Sheet

func (*Book) SheetsView

func (b *Book) SheetsView() []*Sheet

func (*Book) String

func (b *Book) String() string

func (*Book) UnloadSheet

func (b *Book) UnloadSheet(sheetNameOrIndex any) error

func (*Book) UnloadSheets

func (b *Book) UnloadSheets() error

func (*Book) UseMmap

func (b *Book) UseMmap() bool

func (*Book) VeryHiddenSheets

func (b *Book) VeryHiddenSheets() []*Sheet

func (*Book) VisibleNamesInScope

func (b *Book) VisibleNamesInScope(scope any) ([]*Name, error)

func (*Book) VisibleSheets

func (b *Book) VisibleSheets() []*Sheet

func (*Book) XFCount

func (b *Book) XFCount() int

func (*Book) XFs

func (b *Book) XFs() []*XF

type Cell

type Cell struct {
	Row     int
	Column  int
	Ctype   int
	Value   any
	Formula string
	XFIndex int
}

func (Cell) BoolValue

func (c Cell) BoolValue() (bool, bool)

func (Cell) ErrorText

func (c Cell) ErrorText() string

func (Cell) FloatValue

func (c Cell) FloatValue() (float64, bool)

func (Cell) IntValue

func (c Cell) IntValue() (int, bool)

func (Cell) IsBlank

func (c Cell) IsBlank() bool

func (Cell) IsBoolean

func (c Cell) IsBoolean() bool

func (Cell) IsDate

func (c Cell) IsDate() bool

func (Cell) IsEmpty

func (c Cell) IsEmpty() bool

func (Cell) IsError

func (c Cell) IsError() bool

func (Cell) IsNumber

func (c Cell) IsNumber() bool

func (Cell) IsText

func (c Cell) IsText() bool

func (Cell) String

func (c Cell) String() string

func (Cell) TextValue

func (c Cell) TextValue() (string, bool)

func (Cell) TypeString

func (c Cell) TypeString() string

type Colinfo

type Colinfo struct {
	Width        int
	XFIndex      int
	Hidden       bool
	Bit1Flag     bool
	OutlineLevel int
	Collapsed    bool
}

type CompDoc

type CompDoc struct {
	// contains filtered or unexported fields
}

func NewCompDoc

func NewCompDoc(mem []byte, ignoreWorkbookCorruption bool) (*CompDoc, error)

func (*CompDoc) GetNamedStream

func (c *CompDoc) GetNamedStream(qname string) ([]byte, error)

func (*CompDoc) LocateNamedStream

func (c *CompDoc) LocateNamedStream(qname string) ([]byte, int, int, error)

type CompDocError

type CompDocError string

func (CompDocError) Error

func (e CompDocError) Error() string

type DirNode

type DirNode struct {
	DID      int
	Name     string
	EType    uint8
	Colour   uint8
	LeftDID  int32
	RightDID int32
	RootDID  int32
	FirstSID int32
	TotSize  int32
	Children []int
	Parent   int
}

type Font

type Font struct {
	Bold          bool
	CharacterSet  int
	ColourIndex   int
	Escapement    int
	Family        int
	FontIndex     int
	Height        int
	Italic        bool
	Name          string
	StruckOut     bool
	UnderlineType int
	Underlined    bool
	Weight        int
	Outline       bool
	Shadow        bool
}

type Format

type Format struct {
	FormatKey int
	Type      int
	FormatStr string
}

type FormulaOptions

type FormulaOptions struct {
	BiffVersion int
	RelDelta    bool
	BaseRow     *int
	BaseCol     *int
	SheetIndex  *int
}
type Hyperlink struct {
	RowLo    int
	RowHi    int
	ColLo    int
	ColHi    int
	Type     string
	URL      string
	Desc     string
	TextMark string
	Target   string
	QuickTip string
}

func (Hyperlink) ContainsCell

func (h Hyperlink) ContainsCell(row, col int) bool

func (Hyperlink) Coords

func (h Hyperlink) Coords() [4]int

func (Hyperlink) Description

func (h Hyperlink) Description() string

func (Hyperlink) FirstCol

func (h Hyperlink) FirstCol() int

func (Hyperlink) FirstRow

func (h Hyperlink) FirstRow() int

func (Hyperlink) HasDescription

func (h Hyperlink) HasDescription() bool

func (Hyperlink) HasQuickTip

func (h Hyperlink) HasQuickTip() bool

func (Hyperlink) HasTarget

func (h Hyperlink) HasTarget() bool

func (Hyperlink) HasTextMark

func (h Hyperlink) HasTextMark() bool

func (Hyperlink) HasURL

func (h Hyperlink) HasURL() bool

func (Hyperlink) LastColInclusive

func (h Hyperlink) LastColInclusive() int

func (Hyperlink) LastRowInclusive

func (h Hyperlink) LastRowInclusive() int

func (Hyperlink) QuickTipValue

func (h Hyperlink) QuickTipValue() string

func (Hyperlink) TextMarkValue

func (h Hyperlink) TextMarkValue() string

func (Hyperlink) URLOrPath

func (h Hyperlink) URLOrPath() string

type MSODrawing

type MSODrawing struct{}

type MSObj

type MSObj struct{}

type MSTxo

type MSTxo struct {
	Text            string
	RichTextRunlist [][2]int
}

type MergeRange

type MergeRange struct {
	RowLo int
	RowHi int
	ColLo int
	ColHi int
}

func UnpackCellRangeAddressListUpdatePos

func UnpackCellRangeAddressListUpdatePos(output []MergeRange, data []byte, pos int, biffVersion int, addrSize int) ([]MergeRange, int, error)

func (MergeRange) ContainsCell

func (m MergeRange) ContainsCell(row, col int) bool

func (MergeRange) Coords

func (m MergeRange) Coords() [4]int

func (MergeRange) Height

func (m MergeRange) Height() int

func (MergeRange) Width

func (m MergeRange) Width() int

type Name

type Name struct {
	Hidden          bool
	Func            bool
	VBasic          bool
	Macro           bool
	Complex         bool
	Builtin         bool
	FuncGroup       int
	Binary          bool
	NameIndex       int
	Name            string
	RawFormula      []byte
	FormulaText     string
	Scope           int
	OptionFlags     int
	ExtSheetNum     int
	ExcelSheetIndex int
	BasicFormulaLen int
	Result          *NameResult
	// contains filtered or unexported fields
}

func (*Name) Area2D

func (n *Name) Area2D(clipped bool) (*Sheet, int, int, int, int, error)

func (*Name) Area2d

func (n *Name) Area2d(clipped bool) (*Sheet, int, int, int, int, error)

func (*Name) BuiltinCode

func (n *Name) BuiltinCode() int

func (*Name) Cell

func (n *Name) Cell() (Cell, error)

func (*Name) Evaluate

func (n *Name) Evaluate() (*Operand, error)

func (*Name) FormulaBytes

func (n *Name) FormulaBytes() []byte

func (*Name) FormulaLen

func (n *Name) FormulaLen() int

func (*Name) FunctionGroup

func (n *Name) FunctionGroup() int

func (*Name) HasFormulaText

func (n *Name) HasFormulaText() bool

func (*Name) HasRawFormula

func (n *Name) HasRawFormula() bool

func (*Name) HasResult

func (n *Name) HasResult() bool

func (*Name) HasSingleRef

func (n *Name) HasSingleRef() bool

func (*Name) IsBinary

func (n *Name) IsBinary() bool

func (*Name) IsBuiltin

func (n *Name) IsBuiltin() bool

func (*Name) IsComplex

func (n *Name) IsComplex() bool

func (*Name) IsFunction

func (n *Name) IsFunction() bool

func (*Name) IsGlobal

func (n *Name) IsGlobal() bool

func (*Name) IsHidden

func (n *Name) IsHidden() bool

func (*Name) IsInvalidScope

func (n *Name) IsInvalidScope() bool

func (*Name) IsMacro

func (n *Name) IsMacro() bool

func (*Name) IsMacroScope

func (n *Name) IsMacroScope() bool

func (*Name) IsReferenceResult

func (n *Name) IsReferenceResult() bool

func (*Name) IsRelativeResult

func (n *Name) IsRelativeResult() bool

func (*Name) IsVBasic

func (n *Name) IsVBasic() bool

func (*Name) PublicResult

func (n *Name) PublicResult() *Operand

func (*Name) References

func (n *Name) References() []Ref3D

func (*Name) ResultKindString

func (n *Name) ResultKindString() string

func (*Name) ResultOperand

func (n *Name) ResultOperand() *Operand

func (*Name) ResultText

func (n *Name) ResultText() string

func (*Name) ResultValue

func (n *Name) ResultValue() any

func (*Name) ScopeSheet

func (n *Name) ScopeSheet() *Sheet

func (*Name) ScopeString

func (n *Name) ScopeString() string

func (*Name) SingleRef

func (n *Name) SingleRef() (*Ref3D, bool)

func (*Name) String

func (n *Name) String() string

func (*Name) VisibleInScope

func (n *Name) VisibleInScope(scope int) bool

type NameKey

type NameKey struct {
	LowerName string
	Scope     int
}

type NameResult

type NameResult struct {
	Kind  string
	Value any
	Text  string
}

type Note

type Note struct {
	Author          string
	Row             int
	Col             int
	Text            string
	RichTextRunlist [][2]int
	ObjectID        int
	Show            bool
	RowHidden       bool
	ColHidden       bool
}

func (Note) Coords

func (n Note) Coords() [2]int

func (Note) HasAuthor

func (n Note) HasAuthor() bool

func (Note) HasRichText

func (n Note) HasRichText() bool

func (Note) HasText

func (n Note) HasText() bool

func (Note) Hidden

func (n Note) Hidden() bool

type OpenOptions

type OpenOptions struct {
	FormattingInfo           bool
	RaggedRows               bool
	IgnoreWorkbookCorruption bool
	EncodingOverride         string
}

type Operand

type Operand struct {
	Kind  int
	Value any
	Rank  int
	Text  string
}

func EvaluateFormula

func EvaluateFormula(book *Book, formula []byte, opts FormulaOptions) (*Operand, error)

func EvaluateNameFormula

func EvaluateNameFormula(name *Name) (*Operand, error)

func (Operand) BoolValue

func (o Operand) BoolValue() (bool, bool)

func (Operand) ErrorText

func (o Operand) ErrorText() string

func (Operand) FloatValue

func (o Operand) FloatValue() (float64, bool)

func (Operand) HasText

func (o Operand) HasText() bool

func (Operand) HasValue

func (o Operand) HasValue() bool

func (Operand) IsBoolean

func (o Operand) IsBoolean() bool

func (Operand) IsError

func (o Operand) IsError() bool

func (Operand) IsMissing

func (o Operand) IsMissing() bool

func (Operand) IsNumber

func (o Operand) IsNumber() bool

func (Operand) IsReference

func (o Operand) IsReference() bool

func (Operand) IsRelative

func (o Operand) IsRelative() bool

func (Operand) IsScalar

func (o Operand) IsScalar() bool

func (Operand) IsString

func (o Operand) IsString() bool

func (Operand) KindString

func (o Operand) KindString() string

func (Operand) References

func (o Operand) References() []Ref3D

func (Operand) String

func (o Operand) String() string

func (Operand) StringValue

func (o Operand) StringValue() (string, bool)

type RGB

type RGB struct {
	R int
	G int
	B int
}

type Ref3D

type Ref3D = ref3D

func (Ref3D) ColCount

func (r Ref3D) ColCount() int

func (Ref3D) ColRange

func (r Ref3D) ColRange() (int, int)

func (Ref3D) ContainsCell

func (r Ref3D) ContainsCell(sheet, row, col int) bool

func (Ref3D) ContainsSheet

func (r Ref3D) ContainsSheet(sheet int) bool

func (Ref3D) Coords

func (r Ref3D) Coords() [6]int

func (Ref3D) HasNegativeCoords

func (r Ref3D) HasNegativeCoords() bool

func (Ref3D) IsSingleCell

func (r Ref3D) IsSingleCell() bool

func (Ref3D) IsSingleSheet

func (r Ref3D) IsSingleSheet() bool

func (Ref3D) RowCount

func (r Ref3D) RowCount() int

func (Ref3D) RowRange

func (r Ref3D) RowRange() (int, int)

func (Ref3D) SheetCount

func (r Ref3D) SheetCount() int

func (Ref3D) SheetRange

func (r Ref3D) SheetRange() (int, int)

func (Ref3D) String

func (r Ref3D) String() string

type Rowinfo

type Rowinfo struct {
	Height                 int
	HasDefaultHeight       bool
	OutlineLevel           int
	OutlineGroupStartsEnds bool
	Hidden                 bool
	HeightMismatch         bool
	HasDefaultXFIndex      bool
	XFIndex                int
	AdditionalSpaceAbove   bool
	AdditionalSpaceBelow   bool
}

type Sheet

type Sheet struct {
	BiffVersion                     int
	Name                            string
	Number                          int
	BoundsheetType                  int
	NRows                           int
	NCols                           int
	Cells                           [][]Cell
	ColinfoMap                      map[int]*Colinfo
	RowinfoMap                      map[int]*Rowinfo
	MergedCells                     []MergeRange
	ColLabelRanges                  []MergeRange
	RowLabelRanges                  []MergeRange
	RichTextRunlistMap              map[[2]int][][2]int
	CellNoteMap                     map[[2]int]Note
	HyperlinkList                   []Hyperlink
	HyperlinkMap                    map[[2]int]Hyperlink
	DefColWidth                     *int
	StandardWidth                   *int
	DefaultRowHeight                *int
	DefaultRowHeightMismatch        bool
	DefaultRowHidden                bool
	DefaultAdditionalSpaceAbove     bool
	DefaultAdditionalSpaceBelow     bool
	GCW                             [256]bool
	HorizontalPageBreaks            [][3]int
	VerticalPageBreaks              [][3]int
	ShowFormulas                    bool
	ShowGridLines                   bool
	ShowSheetHeaders                bool
	PanesAreFrozen                  bool
	ShowZeroValues                  bool
	AutomaticGridLineColour         bool
	ColumnsFromRightToLeft          bool
	ShowOutlineSymbols              bool
	RemoveSplitsIfPaneFreezeRemoved bool
	SheetSelected                   bool
	SheetVisible                    bool
	ShowInPageBreakPreview          bool
	FirstVisibleRow                 int
	FirstVisibleCol                 int
	GridlineColourIndex             int
	CachedPageBreakPreviewMagFactor int
	CachedNormalViewMagFactor       int
	SCLMagFactor                    *int
	CookedPageBreakPreviewMagFactor int
	CookedNormalViewMagFactor       int
	// contains filtered or unexported fields
}

func (*Sheet) Book

func (s *Sheet) Book() *Book

func (*Sheet) Cell

func (s *Sheet) Cell(row, col int) (Cell, error)

func (*Sheet) CellType

func (s *Sheet) CellType(row, col int) (int, error)

func (*Sheet) CellValue

func (s *Sheet) CellValue(row, col int) (any, error)

func (*Sheet) CellXFIndex

func (s *Sheet) CellXFIndex(row, col int) (int, error)

func (*Sheet) CellXfIndex

func (s *Sheet) CellXfIndex(row, col int) (int, error)

func (*Sheet) Col

func (s *Sheet) Col(col int) ([]Cell, error)

func (*Sheet) ColLabelRangeCount

func (s *Sheet) ColLabelRangeCount() int

func (*Sheet) ColLabelRangesView

func (s *Sheet) ColLabelRangesView() []MergeRange

func (*Sheet) ColSlice

func (s *Sheet) ColSlice(col int, bounds ...int) ([]Cell, error)

func (*Sheet) ColTypes

func (s *Sheet) ColTypes(col int, bounds ...int) ([]int, error)

func (*Sheet) ColValues

func (s *Sheet) ColValues(col int, bounds ...int) ([]any, error)

func (*Sheet) ComputedColumnWidth

func (s *Sheet) ComputedColumnWidth(col int) (int, error)

func (*Sheet) Dimensions

func (s *Sheet) Dimensions() (int, int)

func (*Sheet) FirstVisible

func (s *Sheet) FirstVisible() (int, int)

func (*Sheet) FormattingInfo

func (s *Sheet) FormattingInfo() bool

func (*Sheet) GetRows

func (s *Sheet) GetRows() <-chan []Cell

func (*Sheet) GetUsedCells

func (s *Sheet) GetUsedCells() ([]Cell, error)

func (*Sheet) GridlineColour

func (s *Sheet) GridlineColour() int

func (*Sheet) HasCell

func (s *Sheet) HasCell(row, col int) bool

func (*Sheet) HasCol

func (s *Sheet) HasCol(col int) bool
func (s *Sheet) HasHyperlink(row, col int) bool
func (s *Sheet) HasHyperlinks() bool

func (*Sheet) HasMergedCells

func (s *Sheet) HasMergedCells() bool

func (*Sheet) HasNote

func (s *Sheet) HasNote(row, col int) bool

func (*Sheet) HasNotes

func (s *Sheet) HasNotes() bool

func (*Sheet) HasPageBreaks

func (s *Sheet) HasPageBreaks() bool

func (*Sheet) HasRow

func (s *Sheet) HasRow(row int) bool

func (*Sheet) HasSCL

func (s *Sheet) HasSCL() bool

func (*Sheet) HasTarget

func (s *Sheet) HasTarget() bool

func (*Sheet) HorizontalBreaks

func (s *Sheet) HorizontalBreaks() [][3]int
func (s *Sheet) Hyperlink(row, col int) (Hyperlink, bool)

func (*Sheet) HyperlinkCount

func (s *Sheet) HyperlinkCount() int

func (*Sheet) HyperlinkMapView

func (s *Sheet) HyperlinkMapView() map[[2]int]Hyperlink
func (s *Sheet) Hyperlinks() []Hyperlink

func (*Sheet) Index

func (s *Sheet) Index() int

func (*Sheet) IsActive

func (s *Sheet) IsActive() bool

func (*Sheet) IsCellUsed

func (s *Sheet) IsCellUsed(row, col int) bool

func (*Sheet) IsEmpty

func (s *Sheet) IsEmpty() bool

func (*Sheet) IsHidden

func (s *Sheet) IsHidden() bool

func (*Sheet) IsSelected

func (s *Sheet) IsSelected() bool

func (*Sheet) IsVeryHidden

func (s *Sheet) IsVeryHidden() bool

func (*Sheet) IsVisible

func (s *Sheet) IsVisible() bool

func (*Sheet) Item

func (s *Sheet) Item(item any) (any, error)

func (*Sheet) IterRows

func (s *Sheet) IterRows() <-chan []Cell

func (*Sheet) MergedCellCount

func (s *Sheet) MergedCellCount() int

func (*Sheet) MergedRanges

func (s *Sheet) MergedRanges() []MergeRange

func (*Sheet) Note

func (s *Sheet) Note(row, col int) (Note, bool)

func (*Sheet) NoteCount

func (s *Sheet) NoteCount() int

func (*Sheet) NoteMapView

func (s *Sheet) NoteMapView() map[[2]int]Note

func (*Sheet) Notes

func (s *Sheet) Notes() []Note

func (*Sheet) PutCell

func (s *Sheet) PutCell(row, col int, ctype int, value any, xfIndex int)

func (*Sheet) PutCellWithFormula

func (s *Sheet) PutCellWithFormula(row, col int, ctype int, value any, xfIndex int, formula string)

func (*Sheet) RaggedRows

func (s *Sheet) RaggedRows() bool

func (*Sheet) ReqFmtInfo

func (s *Sheet) ReqFmtInfo() error

func (*Sheet) RichTextMapView

func (s *Sheet) RichTextMapView() map[[2]int][][2]int

func (*Sheet) Row

func (s *Sheet) Row(row int) ([]Cell, error)

func (*Sheet) RowLabelRangeCount

func (s *Sheet) RowLabelRangeCount() int

func (*Sheet) RowLabelRangesView

func (s *Sheet) RowLabelRangesView() []MergeRange

func (*Sheet) RowLen

func (s *Sheet) RowLen(row int) (int, error)

func (*Sheet) RowSlice

func (s *Sheet) RowSlice(row int, bounds ...int) ([]Cell, error)

func (*Sheet) RowTypes

func (s *Sheet) RowTypes(row int, bounds ...int) ([]int, error)

func (*Sheet) RowValues

func (s *Sheet) RowValues(row int, bounds ...int) ([]any, error)

func (*Sheet) Rows

func (s *Sheet) Rows() ([][]Cell, error)

func (*Sheet) RowsIter

func (s *Sheet) RowsIter() <-chan []Cell

func (*Sheet) SCL

func (s *Sheet) SCL() (int, bool)

func (*Sheet) String

func (s *Sheet) String() string

func (*Sheet) Target

func (s *Sheet) Target() string

func (*Sheet) TidyDimensions

func (s *Sheet) TidyDimensions()

func (*Sheet) UpdateCookedMagFactors

func (s *Sheet) UpdateCookedMagFactors()

func (*Sheet) UsedCellCoords

func (s *Sheet) UsedCellCoords() [][2]int

func (*Sheet) UsedCells

func (s *Sheet) UsedCells() ([]Cell, error)

func (*Sheet) VerticalBreaks

func (s *Sheet) VerticalBreaks() [][3]int

func (*Sheet) Visibility

func (s *Sheet) Visibility() int

func (*Sheet) VisibilityString

func (s *Sheet) VisibilityString() string

func (*Sheet) ZoomFactors

func (s *Sheet) ZoomFactors() (cachedPreview, cachedNormal int, cookedPreview, cookedNormal int)

type StyleRef

type StyleRef struct {
	BuiltIn bool
	XFIndex int
}

type XF

type XF struct {
	IsStyle          bool
	Lotus123Prefix   bool
	ParentStyleIndex int
	FormatFlag       bool
	FontFlag         bool
	AlignmentFlag    bool
	BorderFlag       bool
	BackgroundFlag   bool
	ProtectionFlag   bool
	XFIndex          int
	FontIndex        int
	FormatKey        int
	Protection       XFProtection
	Background       XFBackground
	Alignment        XFAlignment
	Border           XFBorder
}

type XFAlignment

type XFAlignment struct {
	HorAlign      int
	VertAlign     int
	Rotation      int
	TextWrapped   bool
	IndentLevel   int
	ShrinkToFit   bool
	TextDirection int
}

type XFBackground

type XFBackground struct {
	FillPattern           int
	BackgroundColourIndex int
	PatternColourIndex    int
}

type XFBorder

type XFBorder struct {
	TopColourIndex    int
	BottomColourIndex int
	LeftColourIndex   int
	RightColourIndex  int
	DiagColourIndex   int
	TopLineStyle      int
	BottomLineStyle   int
	LeftLineStyle     int
	RightLineStyle    int
	DiagLineStyle     int
	DiagDown          bool
	DiagUp            bool
}

type XFProtection

type XFProtection struct {
	CellLocked    bool
	FormulaHidden bool
}

type XLDateError

type XLDateError struct {
	Kind  string
	Value any
}

func (XLDateError) Error

func (e XLDateError) Error() string

type XLRDError

type XLRDError string

func (XLRDError) Error

func (e XLRDError) Error() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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