sheets

package module
v0.0.0-...-b266511 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 15 Imported by: 0

README

sheets

This project provides a wrapper around the Google Sheets API, simplifying the process of creating and adding formatting to a Google Sheet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSpreadsheetID

func GetSpreadsheetID(url string) (string, error)

GetSpreadsheetID returns the Google Sheets spreadsheet ID for the given URL. If the URL is an invalid format, an error will be returned.

func GoogleSheetsService

func GoogleSheetsService(ctx context.Context, credentialsFile, tokenFile string) (*sheets.Service, error)

func PaleYellow

func PaleYellow() color.Color

Types

type Cell

type Cell struct {
	Text      string
	Hyperlink string
}

func (*Cell) HyperlinkFormula

func (c *Cell) HyperlinkFormula() string

type Row

type Row struct {
	Cells    []*Cell
	Color    color.Color
	BoldText bool
}

func TotalRow

func TotalRow(values ...string) *Row

func (*Row) ToCells

func (r *Row) ToCells() []string

type Spreadsheet

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

Spreadsheet represents a Google Spreadsheet, which can contain multiple sheets, each with structured information contained in cells. A Spreadsheet has a unique spreadsheetID value, which can be found in a Google Sheets URL. See https://developers.google.com/sheets/api/guides/concepts for more information.

func Create

func Create(ctx context.Context, credentialsFile, tokenFile, title string, data map[string][]*Row) (*Spreadsheet, error)

Create creates a spreadsheet with the provided title and data.

func Open

func Open(ctx context.Context, credentialsFile, tokenFile, id string) (*Spreadsheet, error)

Open opens an exist Spreadsheet.

func (*Spreadsheet) Append

func (s *Spreadsheet) Append(ctx context.Context, data map[string][]*Row) error

func (*Spreadsheet) GetValues

func (s *Spreadsheet) GetValues(ctx context.Context, readRange string) ([][]interface{}, error)

func (*Spreadsheet) ResizeColumns

func (s *Spreadsheet) ResizeColumns(ctx context.Context) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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