gsheets

package
v0.0.0-...-dec25df Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gsheets contains the functionality necessary to interface with Google Sheets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Email   string // Email (for authentication)
	Key     string // Key (for authentication)
	Domain  string // Sheets are made readable to this domain
	NSheets int    // Number of sheets (tabs) to keep in a spreadsheet
}

type GSheets

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

func NewGSheets

func NewGSheets(cfg *Config) *GSheets

Create a GSheets instance given a Config.

func (*GSheets) AppendWorker

func (g *GSheets) AppendWorker(id, sheetTitle string) (chan<- []string, error)

Create a goroutine which will do the work of appending rows to a sheet. Returns a channel which will receice a row at a time as a []string, or error. Closing the channel signals the worker to exit.

func (*GSheets) CleanupSheets

func (g *GSheets) CleanupSheets(id string) error

Remove Sheet1 and trailing sheets so that the number of sheets is at most nSheets.

func (*GSheets) CreateSpreadsheet

func (g *GSheets) CreateSpreadsheet(title string) (*sheets.Spreadsheet, error)

Create a spreadsheet given a title. Returns a sheets.Spreadsheet pointer or error.

func (*GSheets) DeleteSheet

func (g *GSheets) DeleteSheet(id string, sheetId int64) (*sheets.BatchUpdateSpreadsheetResponse, error)

Delete a sheet from a spreadsheet.

func (*GSheets) GetSpreadsheet

func (g *GSheets) GetSpreadsheet(id string) (*sheets.Spreadsheet, error)

Get a spreadsheet given its id string.

func (*GSheets) MakeFileDomainReadable

func (g *GSheets) MakeFileDomainReadable(id string) (*drive.Permission, error)

Make the spreadsheet (or any file really) readable by people in the organization (domain) who have a link.

func (*GSheets) PrependSheet

func (g *GSheets) PrependSheet(id, title string) (*sheets.BatchUpdateSpreadsheetResponse, error)

Prepend a sheet (tab) to spreadsheet.

Jump to

Keyboard shortcuts

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