googlesheets

package
v1.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ColumTypeTime is the TIME type
	ColumTypeTime ColumnType = "TIME"
	// ColumTypeNumber is the NUMBER type
	ColumTypeNumber = "NUMBER"
	// ColumTypeString is the STRING type
	ColumTypeString = "STRING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnDefinition

type ColumnDefinition struct {
	Header      string
	ColumnIndex int
	// contains filtered or unexported fields
}

ColumnDefinition represents a spreadsheet column definition.

func NewColumnDefinition

func NewColumnDefinition(header string, index int) *ColumnDefinition

NewColumnDefinition creates a new ColumnDefinition.

func (*ColumnDefinition) CheckCell

func (cd *ColumnDefinition) CheckCell(cell *sheets.CellData)

CheckCell checks a ColumnDefinition's cell.

func (*ColumnDefinition) GetType

func (cd *ColumnDefinition) GetType() ColumnType

GetType gets the type of a ColumnDefinition.

func (*ColumnDefinition) GetUnit

func (cd *ColumnDefinition) GetUnit() string

GetUnit gets the unit of a ColumnDefinition.

func (*ColumnDefinition) HasMixedTypes

func (cd *ColumnDefinition) HasMixedTypes() bool

HasMixedTypes returns whether a ColumnDefinition has mixed types.

func (*ColumnDefinition) HasMixedUnits

func (cd *ColumnDefinition) HasMixedUnits() bool

HasMixedUnits returns whether a ColumnDefinition has mixed units.

type ColumnType

type ColumnType string

ColumnType is the set of possible column types

type GoogleClient

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

GoogleClient struct

func NewGoogleClient

func NewGoogleClient(ctx context.Context, auth *models.DatasourceSettings) (*GoogleClient, error)

NewGoogleClient creates a new client and initializes a sheet service and a drive service

func (*GoogleClient) GetSpreadsheet

func (gc *GoogleClient) GetSpreadsheet(spreadSheetID string, sheetRange string, includeGridData bool) (*sheets.Spreadsheet, error)

GetSpreadsheet gets a google spreadsheet struct by id and range

func (*GoogleClient) GetSpreadsheetFiles

func (gc *GoogleClient) GetSpreadsheetFiles() ([]*drive.File, error)

GetSpreadsheetFiles lists all files with spreadsheet mimetype that the client has access to.

func (*GoogleClient) TestClient

func (gc *GoogleClient) TestClient() error

TestClient checks that the client can connect to required services

type GoogleSheets

type GoogleSheets struct {
	Cache *cache.Cache
}

GoogleSheets provides an interface to the Google Sheets API.

func (*GoogleSheets) GetSpreadsheets

func (gs *GoogleSheets) GetSpreadsheets(ctx context.Context, config *models.DatasourceSettings) (map[string]string, error)

GetSpreadsheets gets spreadsheets from the Google API.

func (*GoogleSheets) Query

func (gs *GoogleSheets) Query(ctx context.Context, refID string, qm *models.QueryModel, config *models.DatasourceSettings, timeRange backend.TimeRange) (dr backend.DataResponse)

Query queries a spreadsheet and returns a corresponding data frame.

Jump to

Keyboard shortcuts

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