sheets

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package sheets provides simple utilities for use with the Google Sheets API.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Rate limiter for slowing down access to acceptable rate.
	// Prevents annoying "USER-100s quota limit error".
	Limiter = rate.NewLimiter(ratePerSecond, maxBurstRate)
)

Functions

func ColToAlpha

func ColToAlpha(column int) string

ColToAlpha converts a column number into a column alpha code. Column numbers are zero based.

func RowCol

func RowCol(row, column int) string

RowCol converts a row and column number into a cell address. Row and column numbers are zero based. The cell address is for the "current" sheet.

func SheetRowCol

func SheetRowCol(sheet string, row, column int) string

SheetRowCol converts a sheet name and row and column numbers into a cell address. Row and column numbers are zero based.

Types

type Headers

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

Headers collects result of parsing headers from first row of sheet.

func ParseHeaders

func ParseHeaders(headers []interface{}, required ...string) (*Headers, error)

ParseHeaders takes a row of cells containing headers and an optional list of required headers. Returns a Headers object containing the cell column alpha and number for each header. Also tracks the alpha of the furthest right non-empty column.

func (*Headers) Alpha

func (hdrs *Headers) Alpha(header string) string

Alpha returns the alpha column address for the specified headers.

func (*Headers) MaxAlpha

func (hdrs *Headers) MaxAlpha() string

MaxAlpha returns the furthest right alpha column address in the header row.

func (*Headers) Number

func (hdrs *Headers) Number(header string) int

Number returns the zero-based column index for the header.

Jump to

Keyboard shortcuts

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