Documentation
¶
Overview ¶
Package spreadsheet provides access to the Google Sheets API for reading and updating spreadsheets.
Usage example:
import "github.com/Iwark/spreadsheet"
...
service := &spreadsheet.Spreadsheet{Client: oauthHTTPClient}
Index ¶
- Constants
- type Cell
- type Cells
- type Service
- type Spreadsheet
- func (ss *Spreadsheet) ExistsTitled(title string) bool
- func (ss *Spreadsheet) FindByID(id string) (*Worksheet, error)
- func (ss *Spreadsheet) FindByTitle(title string) (*Worksheet, error)
- func (ss *Spreadsheet) Get(i int) (*Worksheet, error)
- func (ss *Spreadsheet) NewWorksheet(title string, rowCount, colCount int) (*Worksheet, error)
- type VisibilityState
- type Worksheet
Constants ¶
const ( // Scope is the API scope for viewing and managing your Google Spreadsheet data. // Useful for generating JWT values. Scope = "https://spreadsheets.google.com/feeds" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct {
ID string `xml:"id"`
Updated time.Time `xml:"updated"`
Title string `xml:"title"`
Content string `xml:"content"`
Links []link `xml:"link"`
Pos struct {
Row int `xml:"row,attr"`
Col int `xml:"col,attr"`
} `xml:"cell"`
// contains filtered or unexported fields
}
A Cell represents an individual cell in a worksheet.
func (*Cell) FastUpdate ¶
FastUpdate updates the content of the cell and appends the cell to the list of modified cells.
type Cells ¶
type Cells struct {
XMLName xml.Name `xml:"feed"`
Title string `xml:"title"`
Entries []*Cell `xml:"entry"`
}
Cells represents a group of cells.
type Service ¶
type Service struct {
// BaseURL is the base URL used for making API requests.
// Default is "https://spreadsheets.google.com".
BaseURL string
Client *http.Client
// Maximum number of concurrent connections.
// Default is 300.
MaxConns int
// Maximum number of cells to synchronize at once.
// Default is 1000.
MaxSync int
// private or public. Default is private.
Visibility VisibilityState
// Return all empty cells.
ReturnEmpty bool
}
Service represents a Sheets API service instance. Service is the main entry point into using this package.
type Spreadsheet ¶
type Spreadsheet struct {
XMLName xml.Name `xml:"feed"`
Title string `xml:"title"`
Links []link `xml:"link"`
Worksheets []*Worksheet `xml:"entry"`
// contains filtered or unexported fields
}
Spreadsheet represents a spreadsheet. Spreadsheets contain worksheets.
func (*Spreadsheet) ExistsTitled ¶
func (ss *Spreadsheet) ExistsTitled(title string) bool
ExistsTitled returns whether there is a sheet titlted given parameter
func (*Spreadsheet) FindByID ¶
func (ss *Spreadsheet) FindByID(id string) (*Worksheet, error)
FindByID returns the worksheet of passed id.
func (*Spreadsheet) FindByTitle ¶
func (ss *Spreadsheet) FindByTitle(title string) (*Worksheet, error)
FindByTitle returns the worksheet of passed title.
func (*Spreadsheet) Get ¶
func (ss *Spreadsheet) Get(i int) (*Worksheet, error)
Get returns the worksheet at a given index.
func (*Spreadsheet) NewWorksheet ¶
func (ss *Spreadsheet) NewWorksheet(title string, rowCount, colCount int) (*Worksheet, error)
NewWorksheet adds a new worksheet.
type VisibilityState ¶
type VisibilityState int
VisibilityState represents a visibility state for a spreadsheet.
const ( // PrivateVisibility represents a private visibility state for a spreadsheet. Private // spreadsheets require authentication. PrivateVisibility VisibilityState = iota // PublicVisibility represents a public visibility state for a spreadsheet. Public // spreadsheets can be viewed without authentication. PublicVisibility )
func (VisibilityState) String ¶
func (v VisibilityState) String() string
type Worksheet ¶
type Worksheet struct {
ID string `xml:"id"`
Updated time.Time `xml:"updated"`
Title string `xml:"title"`
Content string `xml:"content"`
Links []link `xml:"link"`
CellsFeed string
EditLink string
CSVLink string
MaxRowNum int
MaxColNum int
Rows [][]*Cell
// contains filtered or unexported fields
}
A Worksheet represents a worksheet inside a spreadsheet.
func (*Worksheet) Synchronize ¶
Synchronize saves the modified cells.