Documentation
¶
Index ¶
- Constants
- Variables
- func IsAddress(s string) bool
- type Address
- type CType
- type CVal
- type Cell
- func (c Cell) IsEq(other Cell) bool
- func (c Cell) IsInBounds(s *Sheet) bool
- func (c Cell) Shift(rowDiff int, colDiff int) (Cell, error)
- func (c Cell) ShiftIfRel(rowDiff int, colDiff int) (shifted Cell, err error)
- func (c Cell) StripDollars() Cell
- func (c Cell) ToAddress() Address
- func (c Cell) ToAddressNoSheet() Address
- func (c Cell) ToAddressRel(relativeSheetName string) Address
- func (c Cell) WithDollars() Cell
- type Formula
- type LocalAddress
- type Range
- type RawSheet
- type RawWorkbook
- type Relativeness
- type Sheet
- type Shiftable
- type SplitAddress
- type UsedRange
- type Workbook
Constants ¶
const MAX_COLS = 16_384
const MAX_ROWS = 1_048_576
Variables ¶
var CValEmpty = CVal{Type: CTEmpty}
Functions ¶
Types ¶
type CVal ¶
type CVal struct {
Type CType `json:"-"`
ValString string `json:"str,omitempty"`
// We don't need the precision of float64
ValNumber float32 `json:"num,omitempty"`
ValBool bool `json:"bool,omitempty"`
// If a formula, this is the formula string
ValFormula Formula `json:"formula,omitempty"`
// If the formula underwent computation, this is true
HasComputed bool `json:"-"`
// If the formula underwent computation, this is the type of the computed value.
ComputedType CType `json:"-"`
}
CellVal Represents the value of a cell in a sheet. The json tags are minimal to reduce file size
The computed value can be a string, number, or bool, but not a formula, and so its value can be found in the other fields. E.g. the computed CVal of =SUM(A1:A2) would be Before computation:
{
Type: CTFormula,
HasComputed: false,
ComputedType: CTFormula,
ValFormula: "=SUM(A1:A2)",
}
After computation:
{
Type: CTFormula,
ValNumber: 3,
HasComputed: true,
ComputedType: CTNumber,
ValFormula: "=SUM(A1:A2)",
}
Another possibility is the spill/empty cells. let's say A1:B2 contains [[1,2],[3,4]]; D4 is empty, and C3 contains =A1:B2, then D4 will contain the spill value of B2, which is 4. In this case, we will have the following CVal in D4:
{
Type: CTEmpty,
ValNumber: 4,
HasComputed: true,
ComputedType: CTNumber,
}
aka, an empty cell has a computed number value of 4! This is because of the formula =A1:B2 spilling into D4.
type Cell ¶
type Cell struct {
Sheet string `json:"sheet"`
/* Max 2**20 = 1 048 576 */
Row uint32 `json:"row"`
/* Max 2**14 == 16 384 */
Col uint16 `json:"col"`
RowRel bool `json:"rowRel"`
ColRel bool `json:"colRel"`
}
func (Cell) IsInBounds ¶
func (Cell) ShiftIfRel ¶
func (Cell) StripDollars ¶
func (Cell) ToAddressNoSheet ¶
func (Cell) ToAddressRel ¶
func (Cell) WithDollars ¶
type Formula ¶
type Formula string
func (Formula) RemoveCommaSpaces ¶
func (Formula) RemoveDollars ¶
type LocalAddress ¶
type LocalAddress string
type Range ¶
Make sure that start and end are in the same sheet!
type RawSheet ¶
type RawWorkbook ¶
type Relativeness ¶
type SplitAddress ¶
type SplitAddress struct {
Sheet string // e.g. Sheet1
LocalAddress LocalAddress // e.g. A1
}