Documentation ¶
Index ¶
- Constants
- type Cell
- type CellData
- type DimensionProperties
- type ErrorValue
- type ExtendedValue
- type FetchSpreadsheetOption
- type GridData
- type GridProperties
- type Properties
- type RowData
- type Service
- func (s *Service) AddSheet(spreadsheet *Spreadsheet, sheetProperties SheetProperties) (err error)
- func (s *Service) CreateSpreadsheet(spreadsheet Spreadsheet) (resp Spreadsheet, err error)
- func (s *Service) DeleteColumns(sheet *Sheet, start, end int) (err error)
- func (s *Service) DeleteRows(sheet *Sheet, start, end int) (err error)
- func (s *Service) DeleteSheet(spreadsheet *Spreadsheet, sheetID uint) (err error)
- func (s *Service) DuplicateSheet(spreadsheet *Spreadsheet, sheet *Sheet, index int, title string) (err error)
- func (s *Service) ExpandSheet(sheet *Sheet, row, column uint) (err error)
- func (s *Service) FetchSpreadsheet(id string, options ...FetchSpreadsheetOption) (spreadsheet Spreadsheet, err error)
- func (s *Service) ReloadSpreadsheet(spreadsheet *Spreadsheet) (err error)
- func (s *Service) SyncSheet(sheet *Sheet) (err error)
- type Sheet
- func (sheet *Sheet) DeleteColumns(start, end int) (err error)
- func (sheet *Sheet) DeleteRows(start, end int) (err error)
- func (sheet *Sheet) Synchronize() (err error)
- func (sheet *Sheet) UnmarshalJSON(data []byte) error
- func (sheet *Sheet) Update(row, column int, val string)
- func (sheet *Sheet) UpdateNote(row, column int, note string)
- type SheetData
- type SheetProperties
- type Spreadsheet
- func (spreadsheet *Spreadsheet) SheetByID(id uint) (sheet *Sheet, err error)
- func (spreadsheet *Spreadsheet) SheetByIndex(index uint) (sheet *Sheet, err error)
- func (spreadsheet *Spreadsheet) SheetByTitle(title string) (sheet *Sheet, err error)
- func (spreadsheet *Spreadsheet) UnmarshalJSON(data []byte) error
- type TabColor
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" // SecretFileName is used to get client. SecretFileName = "client_secret.json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct { Row uint Column uint Value string Note string // contains filtered or unexported fields }
Cell describes a cell data
type CellData ¶
type CellData struct { UserEnteredValue ExtendedValue `json:"userEnteredValue"` EffectiveValue ExtendedValue `json:"effectiveValue"` FormattedValue string `json:"formattedValue"` // UserEnteredFormat *CellFormat `json:"userEnteredFormat"` // EffectiveFormat *CellFormat `json:"effectiveFormat"` Hyperlink string `json:"hyperlink"` Note string `json:"note"` }
CellData is data about a specific cell.
type DimensionProperties ¶
type DimensionProperties struct { HiddenByFilter bool `json:"hiddenByFilter"` HiddenByUser bool `json:"hiddenByUser"` PixelSize uint `json:"pixelSize"` }
DimensionProperties is properties about a dimension.
type ErrorValue ¶
ErrorValue is an error in a cell.
type ExtendedValue ¶
type ExtendedValue struct { NumberValue float64 `json:"numberValue"` StringValue string `json:"stringValue"` BoolValue bool `json:"boolValue"` FormulaValue string `json:"formulaValue"` ErrorValue ErrorValue `json:"errorValue"` }
ExtendedValue is the kinds of value that a cell in a spreadsheet can have.
type FetchSpreadsheetOption ¶
type FetchSpreadsheetOption func(*spreadsheetConfig)
FetchSpreadsheetOption is the option for FetchSpreadsheet function
func WithCache ¶
func WithCache(interval time.Duration) FetchSpreadsheetOption
WithCache gives a cacheInterval option for FetchSpreadsheet function
type GridData ¶
type GridData struct { StartRow uint `json:"startRow"` StartColumn uint `json:"startColumn"` RowData []RowData `json:"rowData"` RowMetadata []*DimensionProperties `json:"rowMetadata"` ColumnMetadata []*DimensionProperties `json:"columnMetadata"` }
GridData is data in the grid, as well as metadata about the dimensions.
type GridProperties ¶
type GridProperties struct { RowCount uint `json:"rowCount"` ColumnCount uint `json:"columnCount"` FrozenRowCount uint `json:"frozenRowCount"` FrozenColumnCount uint `json:"frozenColumnCount"` HideGridlines bool `json:"hideGridlines"` }
GridProperties is properties of a grid.
type Properties ¶
type Properties struct { Title string `json:"title"` Locale string `json:"locale"` AutoRecalc string `json:"autoRecalc"` TimeZone string `json:"timezone"` }
Properties is properties of a spreadsheet.
type RowData ¶
type RowData struct {
Values []CellData `json:"values"`
}
RowData is data about each cell in a row.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents a Sheets API service instance. Service is the main entry point into using this package.
func NewService ¶
NewService makes a new service with the secret file.
func NewServiceWithClient ¶
NewServiceWithClient makes a new service by the client.
func (*Service) AddSheet ¶
func (s *Service) AddSheet(spreadsheet *Spreadsheet, sheetProperties SheetProperties) (err error)
AddSheet adds a sheet
func (*Service) CreateSpreadsheet ¶
func (s *Service) CreateSpreadsheet(spreadsheet Spreadsheet) (resp Spreadsheet, err error)
CreateSpreadsheet creates a spreadsheet with the given title
func (*Service) DeleteColumns ¶
DeleteColumns deletes columns from the sheet
func (*Service) DeleteRows ¶
DeleteRows deletes rows from the sheet
func (*Service) DeleteSheet ¶
func (s *Service) DeleteSheet(spreadsheet *Spreadsheet, sheetID uint) (err error)
DeleteSheet deletes the sheet
func (*Service) DuplicateSheet ¶
func (s *Service) DuplicateSheet(spreadsheet *Spreadsheet, sheet *Sheet, index int, title string) (err error)
DuplicateSheet duplicates the contents of a sheet
func (*Service) ExpandSheet ¶
ExpandSheet expands the range of the sheet
func (*Service) FetchSpreadsheet ¶
func (s *Service) FetchSpreadsheet(id string, options ...FetchSpreadsheetOption) (spreadsheet Spreadsheet, err error)
FetchSpreadsheet fetches the spreadsheet by the id.
func (*Service) ReloadSpreadsheet ¶
func (s *Service) ReloadSpreadsheet(spreadsheet *Spreadsheet) (err error)
ReloadSpreadsheet reloads the spreadsheet
type Sheet ¶
type Sheet struct { Properties SheetProperties `json:"properties"` Data SheetData `json:"data"` Spreadsheet *Spreadsheet `json:"-"` Rows [][]Cell `json:"-"` Columns [][]Cell `json:"-"` // contains filtered or unexported fields }
Sheet is a sheet in a spreadsheet.
func (*Sheet) DeleteColumns ¶
DeleteColumns deletes columns from the sheet
func (*Sheet) DeleteRows ¶
DeleteRows deletes rows from the sheet
func (*Sheet) Synchronize ¶
Synchronize reflects the changes of the sheet.
func (*Sheet) UnmarshalJSON ¶
UnmarshalJSON embeds rows and columns to the sheet.
func (*Sheet) UpdateNote ¶
UpdateNote updates a cell's note
type SheetData ¶
type SheetData struct {
// contains filtered or unexported fields
}
SheetData is data of the sheet
func (*SheetData) UnmarshalJSON ¶
UnmarshalJSON let SheetData to be unmarshaled
type SheetProperties ¶
type SheetProperties struct { ID uint `json:"sheetId,omitempty"` Title string `json:"title,omitempty"` Index uint `json:"index,omitempty"` SheetType string `json:"sheetType,omitempty"` GridProperties GridProperties `json:"gridProperties,omitempty"` Hidden bool `json:"hidden,omitempty"` TabColor TabColor `json:"tabColor,omitempty"` RightToLeft bool `json:"rightToLeft,omitempty"` }
SheetProperties is properties of a sheet.
type Spreadsheet ¶
type Spreadsheet struct { ID string `json:"spreadsheetId"` Properties Properties `json:"properties"` Sheets []Sheet `json:"sheets"` // contains filtered or unexported fields }
Spreadsheet represents a spreadsheet.
func (*Spreadsheet) SheetByID ¶
func (spreadsheet *Spreadsheet) SheetByID(id uint) (sheet *Sheet, err error)
SheetByID gets a sheet by the given ID.
func (*Spreadsheet) SheetByIndex ¶
func (spreadsheet *Spreadsheet) SheetByIndex(index uint) (sheet *Sheet, err error)
SheetByIndex gets a sheet by the given index.
func (*Spreadsheet) SheetByTitle ¶
func (spreadsheet *Spreadsheet) SheetByTitle(title string) (sheet *Sheet, err error)
SheetByTitle gets a sheet by the given title.
func (*Spreadsheet) UnmarshalJSON ¶
func (spreadsheet *Spreadsheet) UnmarshalJSON(data []byte) error
UnmarshalJSON embeds spreadsheet to sheets.