Documentation
¶
Overview ¶
Package gsheets holds hand-written wire types for the Google Sheets API v4 fields this server reads and writes.
The generated client (google.golang.org/api) is deliberately not a dependency: it drags gRPC, OpenTelemetry and the cloud auth stack into a binary that needs JSON over HTTP. These structs cover the fields the server actually asks for, and nothing else, so a field appearing here means some code reads it.
The package imports nothing and knows nothing about HTTP.
Index ¶
- Constants
- func Ptr[T any](v T) *T
- type AddBandingReply
- type AddBandingRequest
- type AddChartReply
- type AddChartRequest
- type AddConditionalFormatRuleRequest
- type AddDataSourceReply
- type AddDataSourceRequest
- type AddNamedRangeReply
- type AddNamedRangeRequest
- type AddProtectedRangeReply
- type AddProtectedRangeRequest
- type AddSheetReply
- type AddSheetRequest
- type AddSlicerReply
- type AddSlicerRequest
- type AddTableReply
- type AddTableRequest
- type AppendValuesResponse
- type AutoFillRequest
- type AutoResizeDimensionsRequest
- type BandedRange
- type BandingProperties
- type BasicChartAxis
- type BasicChartDomain
- type BasicChartSeries
- type BasicChartSpec
- type BatchGetValuesResponse
- type BatchUpdateSpreadsheetRequest
- type BatchUpdateSpreadsheetResponse
- type BigQueryDataSourceSpec
- type BigQueryQuerySpec
- type BigQueryTableSpec
- type BooleanCondition
- type BooleanRule
- type Border
- type Borders
- type CancelDataSourceRefreshRequest
- type CellData
- type CellFormat
- type ChartData
- type ChartSourceRange
- type ChartSpec
- type ClearValuesResponse
- type Color
- type ColorStyle
- type ConditionValue
- type ConditionalFormatRule
- type CopyPasteRequest
- type CopySheetToAnotherSpreadsheetRequest
- type CreateDeveloperMetadataReply
- type CreateDeveloperMetadataRequest
- type CutPasteRequest
- type DataExecutionStatus
- type DataFilter
- type DataSource
- type DataSourceSpec
- type DataValidationRule
- type DeleteBandingRequest
- type DeleteConditionalFormatRuleReply
- type DeleteConditionalFormatRuleRequest
- type DeleteDataSourceRequest
- type DeleteDeveloperMetadataReply
- type DeleteDeveloperMetadataRequest
- type DeleteDimensionRequest
- type DeleteDuplicatesReply
- type DeleteDuplicatesRequest
- type DeleteEmbeddedObjectRequest
- type DeleteNamedRangeRequest
- type DeleteProtectedRangeRequest
- type DeleteSheetRequest
- type DeleteTableRequest
- type DeveloperMetadata
- type DeveloperMetadataLocation
- type DeveloperMetadataLookup
- type DimensionGroupRequest
- type DimensionProperties
- type DimensionRange
- type DuplicateSheetReply
- type DuplicateSheetRequest
- type Editors
- type EmbeddedChart
- type EmbeddedObjectPosition
- type ErrorValue
- type ExtendedValue
- type FilterView
- type FindReplaceReply
- type FindReplaceRequest
- type GradientRule
- type GridCoordinate
- type GridData
- type GridProperties
- type GridRange
- type InsertDimensionRequest
- type MatchedDeveloperMetadata
- type MergeCellsRequest
- type MoveDimensionRequest
- type NamedRange
- type NewChart
- type NewSheet
- type NewSheetProperties
- type NewSlicer
- type NewSpreadsheet
- type NumberFormat
- type OverlayPosition
- type PieChartSpec
- type PivotGroup
- type PivotTable
- type PivotValue
- type ProtectedRange
- type RandomizeRangeRequest
- type RefreshDataSourceObjectExecutionStatus
- type RefreshDataSourceReply
- type RefreshDataSourceRequest
- type RepeatCellRequest
- type Reply
- type Request
- type RowData
- type SearchDeveloperMetadataRequest
- type SearchDeveloperMetadataResponse
- type SetDataValidationRequest
- type Sheet
- type SheetProperties
- type Slicer
- type SlicerSpec
- type SortRangeRequest
- type SortSpec
- type SourceAndDestination
- type Spreadsheet
- type SpreadsheetProperties
- type Table
- type TableColumn
- type TextFormat
- type TextToColumnsRequest
- type TrimWhitespaceReply
- type TrimWhitespaceRequest
- type UnmergeCellsRequest
- type UpdateBandingRequest
- type UpdateBordersRequest
- type UpdateCellsRequest
- type UpdateChartSpecRequest
- type UpdateConditionalFormatRuleRequest
- type UpdateDeveloperMetadataReply
- type UpdateDeveloperMetadataRequest
- type UpdateDimensionPropertiesRequest
- type UpdateEmbeddedObjectPositionReply
- type UpdateEmbeddedObjectPositionRequest
- type UpdateNamedRangeRequest
- type UpdateProtectedRangeRequest
- type UpdateSheetPropertiesRequest
- type UpdateSlicerSpecRequest
- type UpdateTableRequest
- type UpdateValuesResponse
- type ValueRange
Constants ¶
const ( BorderNone = "NONE" BorderThin = "SOLID" BorderMedium = "SOLID_MEDIUM" BorderThick = "SOLID_THICK" BorderDotted = "DOTTED" BorderDashed = "DASHED" BorderDouble = "DOUBLE" )
Border styles, as the API spells them.
const ( AlignLeft = "LEFT" AlignCentre = "CENTER" AlignRight = "RIGHT" AlignTop = "TOP" AlignMiddle = "MIDDLE" AlignBottom = "BOTTOM" WrapOverflow = "OVERFLOW_CELL" WrapLegacy = "LEGACY_WRAP" WrapClip = "CLIP" WrapWrap = "WRAP" )
Horizontal and vertical alignment, and the wrap strategies.
const ( NumberFormatText = "TEXT" NumberFormatNumber = "NUMBER" NumberFormatPercent = "PERCENT" NumberFormatCurrency = "CURRENCY" NumberFormatDate = "DATE" NumberFormatTime = "TIME" NumberFormatDateTime = "DATE_TIME" NumberFormatScientific = "SCIENTIFIC" )
Number format types, as the API spells them.
const ( MergeAll = "MERGE_ALL" MergeColumns = "MERGE_COLUMNS" MergeRows = "MERGE_ROWS" )
Merge types, as the API spells them.
const ( SortAscending = "ASCENDING" SortDescending = "DESCENDING" )
Sort orders, as the API spells them.
const ( DelimiterComma = "COMMA" DelimiterSemicolon = "SEMICOLON" DelimiterPeriod = "PERIOD" DelimiterSpace = "SPACE" DelimiterCustom = "CUSTOM" DelimiterAutodetect = "AUTODETECT" )
Delimiter types, as the API spells them.
const ( PasteNormal = "PASTE_NORMAL" PasteValues = "PASTE_VALUES" PasteFormat = "PASTE_FORMAT" PasteFormula = "PASTE_FORMULA" PasteDataValidation = "PASTE_DATA_VALIDATION" PasteConditional = "PASTE_CONDITIONAL_FORMATTING" PasteNormalOrientation = "NORMAL" PasteTranspose = "TRANSPOSE" )
Paste types and orientations, as the API spells them.
const ( DimensionRows = "ROWS" DimensionColumns = "COLUMNS" )
Dimensions, as the API spells them.
const ( VisibilityDocument = "DOCUMENT" VisibilityProject = "PROJECT" )
Visibility values. DOCUMENT is what this server writes.
PROJECT scopes an entry to the OAuth client that created it, and this server is distributed for people to run under a client id of their own — so a PROJECT anchor would vanish on a re-install with nothing to say why. Both were confirmed to work live; the choice is the consequence of how this is installed, not of what the API allows.
const ( LocationRow = "ROW" LocationColumn = "COLUMN" LocationSheet = "SHEET" LocationSpreadsheet = "SPREADSHEET" )
Location types, as the API reports them. The field is read-only: it is derived from which location field was set.
const ( MatchExact = "EXACT_LOCATION" MatchIntersecting = "INTERSECTING_LOCATION" )
Location matching strategies for a lookup.
A sheet location with INTERSECTING returns every row and column anchor on that sheet as well as the sheet's own, which is what makes listing one request. A spreadsheet location with INTERSECTING is refused by the API: "DeveloperMetadataLookup.spreadsheet is true, but locationMatchingStrategy was specified as INTERSECTING".
Variables ¶
This section is empty.
Functions ¶
func Ptr ¶ added in v0.1.0
func Ptr[T any](v T) *T
Ptr is the address of a value, for the API's many optional scalars.
The API distinguishes "absent" from "zero" in a dozen places where the zero is meaningful — a sheet index, a start row, a frozen row count — so the wire types use pointers and the callers need this.
Types ¶
type AddBandingReply ¶ added in v0.2.0
type AddBandingReply struct {
BandedRange *BandedRange `json:"bandedRange,omitempty"`
}
AddBandingReply carries the id.
type AddBandingRequest ¶ added in v0.2.0
type AddBandingRequest struct {
BandedRange *BandedRange `json:"bandedRange,omitempty"`
}
AddBandingRequest adds alternating colours.
type AddChartReply ¶ added in v0.4.0
type AddChartReply struct {
Chart *EmbeddedChart `json:"chart,omitempty"`
}
AddChartReply carries the id Google chose.
type AddChartRequest ¶ added in v0.4.0
type AddChartRequest struct {
Chart *NewChart `json:"chart,omitempty"`
}
AddChartRequest adds a chart.
type AddConditionalFormatRuleRequest ¶ added in v0.2.0
type AddConditionalFormatRuleRequest struct {
Rule *ConditionalFormatRule `json:"rule,omitempty"`
Index int `json:"index"`
}
AddConditionalFormatRuleRequest inserts a rule at an index. Rules are evaluated in order and the index is how a caller says which wins.
type AddDataSourceReply ¶ added in v0.4.0
type AddDataSourceReply struct {
DataSource *DataSource `json:"dataSource,omitempty"`
DataExecutionStatus *DataExecutionStatus `json:"dataExecutionStatus,omitempty"`
}
AddDataSourceReply carries the source that was made and how its first refresh went.
type AddDataSourceRequest ¶ added in v0.4.0
type AddDataSourceRequest struct {
DataSource *DataSource `json:"dataSource,omitempty"`
}
AddDataSourceRequest connects a source, and creates a DATA_SOURCE sheet for it.
type AddNamedRangeReply ¶ added in v0.2.0
type AddNamedRangeReply struct {
NamedRange *NamedRange `json:"namedRange,omitempty"`
}
AddNamedRangeReply carries the id Google assigned.
type AddNamedRangeRequest ¶ added in v0.2.0
type AddNamedRangeRequest struct {
NamedRange *NamedRange `json:"namedRange,omitempty"`
}
AddNamedRangeRequest names a rectangle.
type AddProtectedRangeReply ¶ added in v0.2.0
type AddProtectedRangeReply struct {
ProtectedRange *ProtectedRange `json:"protectedRange,omitempty"`
}
AddProtectedRangeReply carries the id.
type AddProtectedRangeRequest ¶ added in v0.2.0
type AddProtectedRangeRequest struct {
ProtectedRange *ProtectedRange `json:"protectedRange,omitempty"`
}
AddProtectedRangeRequest protects a rectangle.
type AddSheetReply ¶ added in v0.1.0
type AddSheetReply struct {
Properties *SheetProperties `json:"properties,omitempty"`
}
AddSheetReply carries the properties of the sheet that was added, including the id Google assigned it.
type AddSheetRequest ¶ added in v0.1.0
type AddSheetRequest struct {
Properties *NewSheetProperties `json:"properties,omitempty"`
}
AddSheetRequest adds a tab.
type AddSlicerReply ¶ added in v0.4.0
type AddSlicerReply struct {
Slicer *Slicer `json:"slicer,omitempty"`
}
AddSlicerReply carries the id Google chose.
type AddSlicerRequest ¶ added in v0.4.0
type AddSlicerRequest struct {
Slicer *NewSlicer `json:"slicer,omitempty"`
}
AddSlicerRequest adds a slicer.
type AddTableReply ¶ added in v0.2.0
type AddTableReply struct {
Table *Table `json:"table,omitempty"`
}
AddTableReply carries the table Google made, with its id.
type AddTableRequest ¶ added in v0.2.0
type AddTableRequest struct {
Table *Table `json:"table,omitempty"`
}
AddTableRequest makes a native table.
type AppendValuesResponse ¶ added in v0.1.0
type AppendValuesResponse struct {
SpreadsheetID string `json:"spreadsheetId,omitempty"`
TableRange string `json:"tableRange,omitempty"`
Updates *UpdateValuesResponse `json:"updates,omitempty"`
}
AppendValuesResponse is what values.append returns.
TableRange is the block Google decided to append after, which is not predictable from the range given: verified live, a range naming a cell in the first block appends after that block, and a whole-sheet range appends after the last one. So it is reported rather than assumed.
type AutoFillRequest ¶ added in v0.2.0
type AutoFillRequest struct {
SourceAndDestination *SourceAndDestination `json:"sourceAndDestination,omitempty"`
}
AutoFillRequest continues a series into the rest of a rectangle.
SourceAndDestination is the explicit form: it names the source rows or columns and how far to fill. The bare Range form asks Google to guess which part is the source, which is one guess too many for a write.
type AutoResizeDimensionsRequest ¶ added in v0.1.0
type AutoResizeDimensionsRequest struct {
Dimensions *DimensionRange `json:"dimensions,omitempty"`
}
AutoResizeDimensionsRequest sizes a band to its contents.
type BandedRange ¶
type BandedRange struct {
BandedRangeID int `json:"bandedRangeId,omitempty"`
Range *GridRange `json:"range,omitempty"`
RowProperties *BandingProperties `json:"rowProperties,omitempty"`
ColumnProperties *BandingProperties `json:"columnProperties,omitempty"`
}
BandedRange is alternating-colour banding over a range. Exactly one of the two property sets is used: banding runs down rows or across columns, not both.
type BandingProperties ¶ added in v0.2.0
type BandingProperties struct {
HeaderColorStyle *ColorStyle `json:"headerColorStyle,omitempty"`
FirstBandColorStyle *ColorStyle `json:"firstBandColorStyle,omitempty"`
SecondBandColorStyle *ColorStyle `json:"secondBandColorStyle,omitempty"`
}
BandingProperties are the colours of an alternating band.
type BasicChartAxis ¶ added in v0.4.0
type BasicChartAxis struct {
Position string `json:"position,omitempty"`
Title string `json:"title,omitempty"`
}
BasicChartAxis is one labelled axis.
type BasicChartDomain ¶ added in v0.4.0
type BasicChartDomain struct {
Domain *ChartData `json:"domain,omitempty"`
}
BasicChartDomain is what runs along the chart's category axis.
type BasicChartSeries ¶ added in v0.4.0
type BasicChartSeries struct {
Series *ChartData `json:"series,omitempty"`
TargetAxis string `json:"targetAxis,omitempty"`
}
BasicChartSeries is one line, bar or set of points.
type BasicChartSpec ¶ added in v0.4.0
type BasicChartSpec struct {
ChartType string `json:"chartType,omitempty"`
LegendPosition string `json:"legendPosition,omitempty"`
StackedType string `json:"stackedType,omitempty"`
HeaderCount int `json:"headerCount,omitempty"`
Domains []*BasicChartDomain `json:"domains,omitempty"`
Series []*BasicChartSeries `json:"series,omitempty"`
Axis []*BasicChartAxis `json:"axis,omitempty"`
}
BasicChartSpec is the bar/line/area/column/scatter family.
type BatchGetValuesResponse ¶
type BatchGetValuesResponse struct {
SpreadsheetID string `json:"spreadsheetId,omitempty"`
ValueRanges []*ValueRange `json:"valueRanges,omitempty"`
}
BatchGetValuesResponse is the values.batchGet response.
type BatchUpdateSpreadsheetRequest ¶ added in v0.1.0
type BatchUpdateSpreadsheetRequest struct {
Requests []*Request `json:"requests,omitempty"`
}
BatchUpdateSpreadsheetRequest is the structural write: one atomic batch of typed requests.
The discovery document is explicit that the batch is all or nothing — "If any request is not valid then the entire request will fail and nothing will be applied" — and that a batch counts once against quota. So ops compile into one of these rather than into several calls.
`includeSpreadsheetInResponse` is deliberately absent. It would bring the state after the write back in the same response and save the card re-read that follows every structural change here, and the fields to use it are not written until something uses them: this package's rule is that a field appearing in it means some code reads it. §17a carries the entry, including the live probe it needs first.
type BatchUpdateSpreadsheetResponse ¶ added in v0.1.0
type BatchUpdateSpreadsheetResponse struct {
SpreadsheetID string `json:"spreadsheetId,omitempty"`
Replies []*Reply `json:"replies,omitempty"`
}
BatchUpdateSpreadsheetResponse is that request's answer. Replies line up with the requests that produced them, one for one.
type BigQueryDataSourceSpec ¶ added in v0.4.0
type BigQueryDataSourceSpec struct {
ProjectID string `json:"projectId,omitempty"`
QuerySpec *BigQueryQuerySpec `json:"querySpec,omitempty"`
TableSpec *BigQueryTableSpec `json:"tableSpec,omitempty"`
}
BigQueryDataSourceSpec is a BigQuery source: either a whole table or a query. The project is charged for every query run against it.
type BigQueryQuerySpec ¶ added in v0.4.0
type BigQueryQuerySpec struct {
RawQuery string `json:"rawQuery,omitempty"`
}
BigQueryQuerySpec is a raw SQL query.
type BigQueryTableSpec ¶ added in v0.4.0
type BigQueryTableSpec struct {
TableProjectID string `json:"tableProjectId,omitempty"`
DatasetID string `json:"datasetId,omitempty"`
TableID string `json:"tableId,omitempty"`
}
BigQueryTableSpec names a table.
type BooleanCondition ¶
type BooleanCondition struct {
Type string `json:"type,omitempty"`
Values []*ConditionValue `json:"values,omitempty"`
}
BooleanCondition is a validation or conditional-format condition.
type BooleanRule ¶ added in v0.2.0
type BooleanRule struct {
Condition *BooleanCondition `json:"condition,omitempty"`
Format *CellFormat `json:"format,omitempty"`
}
BooleanRule applies a format when its condition holds.
type Border ¶ added in v0.2.0
type Border struct {
Style string `json:"style,omitempty"`
ColorStyle *ColorStyle `json:"colorStyle,omitempty"`
}
Border is one edge of a cell.
Width is absent on purpose: the API documents it as deprecated and derives the thickness from Style, so a request carrying both would be asking for two things that can disagree. The tool's "1pt solid" reads the number and picks the style.
type Borders ¶ added in v0.2.0
type Borders struct {
Top *Border `json:"top,omitempty"`
Bottom *Border `json:"bottom,omitempty"`
Left *Border `json:"left,omitempty"`
Right *Border `json:"right,omitempty"`
}
Borders are the four edges of one cell, as a cell format carries them. The inner edges are an update's business, not a cell's.
type CancelDataSourceRefreshRequest ¶ added in v0.4.0
type CancelDataSourceRefreshRequest struct {
DataSourceID string `json:"dataSourceId,omitempty"`
IsAll bool `json:"isAll,omitempty"`
}
CancelDataSourceRefreshRequest stops a refresh in flight.
type CellData ¶
type CellData struct {
UserEnteredValue *ExtendedValue `json:"userEnteredValue,omitempty"`
EffectiveValue *ExtendedValue `json:"effectiveValue,omitempty"`
FormattedValue string `json:"formattedValue,omitempty"`
UserEnteredFormat *CellFormat `json:"userEnteredFormat,omitempty"`
EffectiveFormat *CellFormat `json:"effectiveFormat,omitempty"`
DataValidation *DataValidationRule `json:"dataValidation,omitempty"`
Note string `json:"note,omitempty"`
Hyperlink string `json:"hyperlink,omitempty"`
TextFormatRuns []json.RawMessage `json:"textFormatRuns,omitempty"`
ChipRuns []json.RawMessage `json:"chipRuns,omitempty"`
PivotTable json.RawMessage `json:"pivotTable,omitempty"`
DataSourceFormula json.RawMessage `json:"dataSourceFormula,omitempty"`
}
CellData is everything one cell carries. A formula and its result render identically in a values read, which is why the write guard reads UserEnteredValue rather than the formatted string.
type CellFormat ¶
type CellFormat struct {
NumberFormat *NumberFormat `json:"numberFormat,omitempty"`
BackgroundColorStyle *ColorStyle `json:"backgroundColorStyle,omitempty"`
Borders *Borders `json:"borders,omitempty"`
TextFormat *TextFormat `json:"textFormat,omitempty"`
HorizontalAlign string `json:"horizontalAlignment,omitempty"`
VerticalAlign string `json:"verticalAlignment,omitempty"`
WrapStrategy string `json:"wrapStrategy,omitempty"`
}
CellFormat is a cell's format: what read_formatting reports and what format_cells writes.
type ChartData ¶ added in v0.4.0
type ChartData struct {
SourceRange *ChartSourceRange `json:"sourceRange,omitempty"`
}
ChartData is where one domain or series reads from.
type ChartSourceRange ¶ added in v0.4.0
type ChartSourceRange struct {
Sources []*GridRange `json:"sources,omitempty"`
}
ChartSourceRange is a domain's or series' ranges. The API requires exactly one dimension of each to have length 1.
type ChartSpec ¶ added in v0.4.0
type ChartSpec struct {
Title string `json:"title,omitempty"`
Subtitle string `json:"subtitle,omitempty"`
AltText string `json:"altText,omitempty"`
BasicChart *BasicChartSpec `json:"basicChart,omitempty"`
PieChart *PieChartSpec `json:"pieChart,omitempty"`
}
ChartSpec is a chart this server builds from nothing, for add.
It carries the two chart families manage_chart offers. Everything else a spreadsheet may hold — treemaps, waterfalls, org charts, scorecards — is readable, updatable and deletable through the raw spec above and simply cannot be created here, which is a smaller promise than the one a partial struct would silently make.
type ClearValuesResponse ¶ added in v0.1.0
type ClearValuesResponse struct {
SpreadsheetID string `json:"spreadsheetId,omitempty"`
ClearedRange string `json:"clearedRange,omitempty"`
}
ClearValuesResponse is what values.clear returns.
type Color ¶
type Color struct {
Red float64 `json:"red,omitempty"`
Green float64 `json:"green,omitempty"`
Blue float64 `json:"blue,omitempty"`
Alpha float64 `json:"alpha,omitempty"`
}
Color is an RGBA colour with components in 0..1.
type ColorStyle ¶
type ColorStyle struct {
RGBColor *Color `json:"rgbColor,omitempty"`
ThemeColor string `json:"themeColor,omitempty"`
}
ColorStyle is the API's colour union.
type ConditionValue ¶
type ConditionValue struct {
RelativeDate string `json:"relativeDate,omitempty"`
UserEnteredValue string `json:"userEnteredValue,omitempty"`
}
ConditionValue is one operand of a BooleanCondition.
type ConditionalFormatRule ¶ added in v0.2.0
type ConditionalFormatRule struct {
Ranges []*GridRange `json:"ranges,omitempty"`
BooleanRule *BooleanRule `json:"booleanRule,omitempty"`
GradientRule *GradientRule `json:"gradientRule,omitempty"`
}
ConditionalFormatRule is a rule attached to ranges on one sheet. Exactly one of the two rule kinds is set.
type CopyPasteRequest ¶ added in v0.2.0
type CopyPasteRequest struct {
Source *GridRange `json:"source,omitempty"`
Destination *GridRange `json:"destination,omitempty"`
PasteType string `json:"pasteType,omitempty"`
PasteOrientation string `json:"pasteOrientation,omitempty"`
}
CopyPasteRequest copies a rectangle somewhere else and leaves the source alone.
type CopySheetToAnotherSpreadsheetRequest ¶ added in v0.1.0
type CopySheetToAnotherSpreadsheetRequest struct {
DestinationSpreadsheetID string `json:"destinationSpreadsheetId,omitempty"`
}
CopySheetToAnotherSpreadsheetRequest is the body of sheets.copyTo.
type CreateDeveloperMetadataReply ¶ added in v0.3.0
type CreateDeveloperMetadataReply struct {
DeveloperMetadata *DeveloperMetadata `json:"developerMetadata,omitempty"`
}
CreateDeveloperMetadataReply carries the entry as stored, including the id the API assigned.
type CreateDeveloperMetadataRequest ¶ added in v0.3.0
type CreateDeveloperMetadataRequest struct {
DeveloperMetadata *DeveloperMetadata `json:"developerMetadata,omitempty"`
}
CreateDeveloperMetadataRequest adds an entry.
type CutPasteRequest ¶ added in v0.2.0
type CutPasteRequest struct {
Source *GridRange `json:"source,omitempty"`
Destination *GridCoordinate `json:"destination,omitempty"`
PasteType string `json:"pasteType,omitempty"`
}
CutPasteRequest moves a rectangle, emptying the source.
It has no orientation: the API offers none, because a cut is a move and a transposed move has no meaning for the cells left behind.
type DataExecutionStatus ¶ added in v0.4.0
type DataExecutionStatus struct {
State string `json:"state,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorMessage string `json:"errorMessage,omitempty"`
LastRefresh string `json:"lastRefreshTime,omitempty"`
}
DataExecutionStatus is how a refresh went. A refresh is asynchronous, so a successful request means the work was started rather than done — which is why every result here reports the state rather than "done".
type DataFilter ¶ added in v0.3.0
type DataFilter struct {
DeveloperMetadataLookup *DeveloperMetadataLookup `json:"developerMetadataLookup,omitempty"`
}
DataFilter selects by range or by metadata. Only the metadata half is used here; the two range forms belong to the batch-by-filter calls this server does not make.
type DataSource ¶ added in v0.4.0
type DataSource struct {
DataSourceID string `json:"dataSourceId,omitempty"`
SheetID int `json:"sheetId,omitempty"`
Spec *DataSourceSpec `json:"spec,omitempty"`
}
DataSource is an external source connected to a spreadsheet.
type DataSourceSpec ¶ added in v0.4.0
type DataSourceSpec struct {
BigQuery *BigQueryDataSourceSpec `json:"bigQuery,omitempty"`
}
DataSourceSpec says where the data comes from.
type DataValidationRule ¶
type DataValidationRule struct {
Condition *BooleanCondition `json:"condition,omitempty"`
InputMessage string `json:"inputMessage,omitempty"`
Strict bool `json:"strict,omitempty"`
ShowCustomUI bool `json:"showCustomUi,omitempty"`
}
DataValidationRule is a cell's validation rule.
type DeleteBandingRequest ¶ added in v0.2.0
type DeleteBandingRequest struct {
BandedRangeID int `json:"bandedRangeId"`
}
DeleteBandingRequest removes one.
type DeleteConditionalFormatRuleReply ¶ added in v0.2.0
type DeleteConditionalFormatRuleReply struct {
Rule *ConditionalFormatRule `json:"rule,omitempty"`
}
DeleteConditionalFormatRuleReply carries the rule that was removed, so a result can say what went rather than only that something did.
type DeleteConditionalFormatRuleRequest ¶ added in v0.2.0
type DeleteConditionalFormatRuleRequest struct {
Index int `json:"index"`
SheetID int `json:"sheetId"`
}
DeleteConditionalFormatRuleRequest removes the rule at an index.
type DeleteDataSourceRequest ¶ added in v0.4.0
type DeleteDataSourceRequest struct {
DataSourceID string `json:"dataSourceId"`
}
DeleteDataSourceRequest removes a source, its sheet and the links to it.
type DeleteDeveloperMetadataReply ¶ added in v0.3.0
type DeleteDeveloperMetadataReply struct {
DeletedDeveloperMetadata []*DeveloperMetadata `json:"deletedDeveloperMetadata,omitempty"`
}
DeleteDeveloperMetadataReply lists what went, which is the only place the count is available: the request names a filter, not an entry.
type DeleteDeveloperMetadataRequest ¶ added in v0.3.0
type DeleteDeveloperMetadataRequest struct {
DataFilter *DataFilter `json:"dataFilter,omitempty"`
}
DeleteDeveloperMetadataRequest removes every entry its filter matches.
type DeleteDimensionRequest ¶ added in v0.1.0
type DeleteDimensionRequest struct {
Range *DimensionRange `json:"range,omitempty"`
}
DeleteDimensionRequest removes a band and the data in it.
type DeleteDuplicatesReply ¶ added in v0.2.0
type DeleteDuplicatesReply struct {
DuplicatesRemovedCount int `json:"duplicatesRemovedCount,omitempty"`
}
DeleteDuplicatesReply counts the rows it removed.
type DeleteDuplicatesRequest ¶ added in v0.2.0
type DeleteDuplicatesRequest struct {
Range *GridRange `json:"range,omitempty"`
ComparisonColumns []*DimensionRange `json:"comparisonColumns,omitempty"`
}
DeleteDuplicatesRequest removes duplicate rows, comparing the columns it is given.
type DeleteEmbeddedObjectRequest ¶ added in v0.4.0
type DeleteEmbeddedObjectRequest struct {
ObjectID int `json:"objectId"`
}
DeleteEmbeddedObjectRequest removes a chart or a slicer. One request for both, and its reply is empty for both (spike L), so what was removed has to be read before it goes.
type DeleteNamedRangeRequest ¶ added in v0.2.0
type DeleteNamedRangeRequest struct {
NamedRangeID string `json:"namedRangeId,omitempty"`
}
DeleteNamedRangeRequest removes one. The cells are untouched.
type DeleteProtectedRangeRequest ¶ added in v0.2.0
type DeleteProtectedRangeRequest struct {
ProtectedRangeID int `json:"protectedRangeId"`
}
DeleteProtectedRangeRequest removes one.
type DeleteSheetRequest ¶ added in v0.1.0
type DeleteSheetRequest struct {
SheetID int `json:"sheetId"`
}
DeleteSheetRequest removes a tab and everything on it.
type DeleteTableRequest ¶ added in v0.2.0
type DeleteTableRequest struct {
TableID string `json:"tableId,omitempty"`
}
DeleteTableRequest removes the table and leaves the cells.
type DeveloperMetadata ¶ added in v0.3.0
type DeveloperMetadata struct {
MetadataID int `json:"metadataId,omitempty"`
MetadataKey string `json:"metadataKey,omitempty"`
MetadataValue string `json:"metadataValue,omitempty"`
Location *DeveloperMetadataLocation `json:"location,omitempty"`
Visibility string `json:"visibility,omitempty"`
}
DeveloperMetadata is one entry.
type DeveloperMetadataLocation ¶ added in v0.3.0
type DeveloperMetadataLocation struct {
LocationType string `json:"locationType,omitempty"`
Spreadsheet bool `json:"spreadsheet,omitempty"`
SheetID *int `json:"sheetId,omitempty"`
// DimensionRange must be a single bounded row or column. Two rows is
// "DimensionRange must represent a single row or column"; an
// unbounded one is "DimensionRange must specify both a startIndex
// and an endIndex". Both are refused here before they are sent.
DimensionRange *DimensionRange `json:"dimensionRange,omitempty"`
}
DeveloperMetadataLocation is where an entry is attached. Exactly one of the three is set on the way out; LocationType is filled by the API on the way back.
type DeveloperMetadataLookup ¶ added in v0.3.0
type DeveloperMetadataLookup struct {
MetadataID int `json:"metadataId,omitempty"`
MetadataKey string `json:"metadataKey,omitempty"`
MetadataValue string `json:"metadataValue,omitempty"`
MetadataLocation *DeveloperMetadataLocation `json:"metadataLocation,omitempty"`
LocationType string `json:"locationType,omitempty"`
LocationMatchingStrategy string `json:"locationMatchingStrategy,omitempty"`
Visibility string `json:"visibility,omitempty"`
}
DeveloperMetadataLookup selects entries. Every field narrows, and all of them are optional: a key alone is a valid lookup and so is a location type alone.
type DimensionGroupRequest ¶ added in v0.1.0
type DimensionGroupRequest struct {
Range *DimensionRange `json:"range,omitempty"`
}
DimensionGroupRequest adds or removes a collapsible group.
type DimensionProperties ¶ added in v0.1.0
type DimensionProperties struct {
PixelSize int `json:"pixelSize,omitempty"`
}
DimensionProperties is a band's size. Hiding a row or a column is phase 2's, and the field arrives with the code that sets it.
type DimensionRange ¶ added in v0.1.0
type DimensionRange struct {
SheetID int `json:"sheetId"`
Dimension string `json:"dimension,omitempty"`
StartIndex int `json:"startIndex"`
EndIndex int `json:"endIndex"`
}
DimensionRange is a band of rows or columns, zero-based and half-open like every other index the API uses.
type DuplicateSheetReply ¶ added in v0.1.0
type DuplicateSheetReply struct {
Properties *SheetProperties `json:"properties,omitempty"`
}
DuplicateSheetReply names the copy.
type DuplicateSheetRequest ¶ added in v0.1.0
type DuplicateSheetRequest struct {
SourceSheetID int `json:"sourceSheetId"`
InsertSheetIndex *int `json:"insertSheetIndex,omitempty"`
NewSheetName string `json:"newSheetName,omitempty"`
}
DuplicateSheetRequest copies a tab within the same spreadsheet.
type Editors ¶
type Editors struct {
Users []string `json:"users,omitempty"`
Groups []string `json:"groups,omitempty"`
DomainUsersCanEdit bool `json:"domainUsersCanEdit,omitempty"`
}
Editors are the accounts allowed to edit a protected range.
type EmbeddedChart ¶
type EmbeddedChart struct {
ChartID int `json:"chartId,omitempty"`
Spec json.RawMessage `json:"spec,omitempty"`
Position *EmbeddedObjectPosition `json:"position,omitempty"`
}
EmbeddedChart is a chart as it comes back from a read.
Spec is raw for the reason above: it is round-tripped through manage_chart update, and a type here would quietly narrow it.
type EmbeddedObjectPosition ¶ added in v0.4.0
type EmbeddedObjectPosition struct {
SheetID int `json:"sheetId,omitempty"`
OverlayPosition *OverlayPosition `json:"overlayPosition,omitempty"`
NewSheet bool `json:"newSheet,omitempty"`
}
EmbeddedObjectPosition says where a chart or slicer sits. Exactly one of the three is used: SheetID for an object on its own sheet, OverlayPosition for one floating over a grid, and NewSheet only when writing.
type ErrorValue ¶
type ErrorValue struct {
Type string `json:"type,omitempty"`
Message string `json:"message,omitempty"`
}
ErrorValue is a cell holding a formula error such as #REF! or #N/A.
func (*ErrorValue) Display ¶
func (e *ErrorValue) Display() string
Display is what Sheets shows for an error type.
It lives beside the type rather than in whichever package needed it first, because two copies of this table diverge: the fake and the renderer had different fallbacks, so an error type outside the list rendered one way in a formatted read and another way in a raw one, and the tests agreed with both answers.
type ExtendedValue ¶
type ExtendedValue struct {
NumberValue *float64 `json:"numberValue,omitempty"`
StringValue *string `json:"stringValue,omitempty"`
BoolValue *bool `json:"boolValue,omitempty"`
FormulaValue *string `json:"formulaValue,omitempty"`
ErrorValue *ErrorValue `json:"errorValue,omitempty"`
}
ExtendedValue is the API's cell value union: exactly one field is set.
type FilterView ¶
type FilterView struct {
FilterViewID int `json:"filterViewId,omitempty"`
Title string `json:"title,omitempty"`
Range *GridRange `json:"range,omitempty"`
}
FilterView is a saved view over a range.
type FindReplaceReply ¶ added in v0.2.0
type FindReplaceReply struct {
ValuesChanged int `json:"valuesChanged,omitempty"`
FormulasChanged int `json:"formulasChanged,omitempty"`
RowsChanged int `json:"rowsChanged,omitempty"`
SheetsChanged int `json:"sheetsChanged,omitempty"`
OccurrencesChanged int `json:"occurrencesChanged,omitempty"`
}
FindReplaceReply counts what changed.
type FindReplaceRequest ¶ added in v0.2.0
type FindReplaceRequest struct {
Find string `json:"find,omitempty"`
Replacement string `json:"replacement"`
Range *GridRange `json:"range,omitempty"`
MatchCase bool `json:"matchCase,omitempty"`
MatchEntireCell bool `json:"matchEntireCell,omitempty"`
SearchByRegex bool `json:"searchByRegex,omitempty"`
IncludeFormulas bool `json:"includeFormulas,omitempty"`
AllSheets bool `json:"allSheets,omitempty"`
SheetID *int `json:"sheetId,omitempty"`
}
FindReplaceRequest replaces text. Exactly one of Range, SheetID and AllSheets scopes it; this server always sends a range.
type GradientRule ¶ added in v0.2.0
type GradientRule struct{}
GradientRule colours by value between interpolation points.
Empty on purpose. Nothing here builds a gradient and nothing reads its points; a formatting read only needs to know that the colour on a cell came from a rule rather than from the cell, which is this field being present. The points arrive with the code that reads them, as every other field in this package does.
type GridCoordinate ¶ added in v0.2.0
type GridCoordinate struct {
SheetID int `json:"sheetId"`
RowIndex int `json:"rowIndex"`
ColumnIndex int `json:"columnIndex"`
}
GridCoordinate is one cell, zero-based, which is where a cut lands.
type GridData ¶
type GridData struct {
StartRow int `json:"startRow,omitempty"`
StartColumn int `json:"startColumn,omitempty"`
RowData []*RowData `json:"rowData,omitempty"`
}
GridData is a rectangle of cells. StartRow and StartColumn are zero-based offsets into the sheet.
type GridProperties ¶
type GridProperties struct {
RowCount int `json:"rowCount,omitempty"`
ColumnCount int `json:"columnCount,omitempty"`
FrozenRowCount int `json:"frozenRowCount,omitempty"`
FrozenColumnCount int `json:"frozenColumnCount,omitempty"`
HideGridlines bool `json:"hideGridlines,omitempty"`
}
GridProperties are a grid sheet's allocated size and frozen bands. RowCount and ColumnCount are what the sheet has room for, not how far the data reaches.
type GridRange ¶
type GridRange struct {
SheetID int `json:"sheetId"`
StartRowIndex *int `json:"startRowIndex,omitempty"`
EndRowIndex *int `json:"endRowIndex,omitempty"`
StartColumnIndex *int `json:"startColumnIndex,omitempty"`
EndColumnIndex *int `json:"endColumnIndex,omitempty"`
}
GridRange is a range on one sheet in the API's own coordinates: zero-based and half-open, with a missing index meaning unbounded on that side. A1 is one-based and inclusive, so every conversion between the two lives in internal/a1 and nowhere else.
type InsertDimensionRequest ¶ added in v0.1.0
type InsertDimensionRequest struct {
Range *DimensionRange `json:"range,omitempty"`
InheritFromBefore bool `json:"inheritFromBefore,omitempty"`
}
InsertDimensionRequest makes room. InheritFromBefore decides which neighbour's formatting the new band takes; it cannot be true at index zero, since there is nothing before it.
type MatchedDeveloperMetadata ¶ added in v0.3.0
type MatchedDeveloperMetadata struct {
DeveloperMetadata *DeveloperMetadata `json:"developerMetadata,omitempty"`
}
MatchedDeveloperMetadata is one hit and the filters that caught it.
type MergeCellsRequest ¶ added in v0.2.0
type MergeCellsRequest struct {
Range *GridRange `json:"range,omitempty"`
MergeType string `json:"mergeType,omitempty"`
}
MergeCellsRequest joins cells. Sheets keeps the top-left value and discards the rest, which is why the guard reads the rectangle first.
type MoveDimensionRequest ¶ added in v0.1.0
type MoveDimensionRequest struct {
Source *DimensionRange `json:"source,omitempty"`
DestinationIndex int `json:"destinationIndex"`
}
MoveDimensionRequest moves a band. DestinationIndex is where the band starts *before* the move, which is the API's own convention and the one arithmetic trap in this request.
type NamedRange ¶
type NamedRange struct {
NamedRangeID string `json:"namedRangeId,omitempty"`
Name string `json:"name,omitempty"`
Range *GridRange `json:"range,omitempty"`
}
NamedRange is a name attached to a rectangle. A named range shadows a sheet of the same name in an unquoted A1 reference, which is why internal/a1 always quotes.
type NewChart ¶ added in v0.4.0
type NewChart struct {
Spec *ChartSpec `json:"spec,omitempty"`
Position *EmbeddedObjectPosition `json:"position,omitempty"`
}
NewChart is a chart that does not exist yet: a built spec and a position, and no id.
type NewSheet ¶ added in v0.1.0
type NewSheet struct {
Properties *NewSheetProperties `json:"properties,omitempty"`
}
NewSheet is a sheet in a spreadsheets.create request.
type NewSheetProperties ¶ added in v0.1.0
type NewSheetProperties struct {
Title string `json:"title,omitempty"`
Index *int `json:"index,omitempty"`
GridProperties *GridProperties `json:"gridProperties,omitempty"`
}
NewSheetProperties is a sheet that does not exist yet.
It has no sheetId, and that absence is the type's whole reason for being: SheetProperties carries one, the zero value serialises as `"sheetId": 0`, and Google reads that as a request for id 0 — which the first sheet always has. Live, an addSheet built from SheetProperties came back as "Sheet with id 0 already exists", and a create came back with the requested sheet and nothing else.
A field that cannot be set wrongly beats a rule about not setting it.
type NewSlicer ¶ added in v0.4.0
type NewSlicer struct {
Spec *SlicerSpec `json:"spec,omitempty"`
Position *EmbeddedObjectPosition `json:"position,omitempty"`
}
NewSlicer is a slicer that does not exist yet.
type NewSpreadsheet ¶ added in v0.1.0
type NewSpreadsheet struct {
Properties *SpreadsheetProperties `json:"properties,omitempty"`
Sheets []*NewSheet `json:"sheets,omitempty"`
}
NewSpreadsheet is the spreadsheets.create request body. Separate from Spreadsheet for the same reason NewSheetProperties is separate from SheetProperties: nothing here has an id yet.
type NumberFormat ¶
type NumberFormat struct {
Type string `json:"type,omitempty"`
Pattern string `json:"pattern,omitempty"`
}
NumberFormat is a cell's number format.
type OverlayPosition ¶ added in v0.4.0
type OverlayPosition struct {
AnchorCell *GridCoordinate `json:"anchorCell,omitempty"`
OffsetXPixels int `json:"offsetXPixels,omitempty"`
OffsetYPixels int `json:"offsetYPixels,omitempty"`
WidthPixels int `json:"widthPixels,omitempty"`
HeightPixels int `json:"heightPixels,omitempty"`
}
OverlayPosition is a floating object's anchor and size.
type PieChartSpec ¶ added in v0.4.0
type PieChartSpec struct {
Domain *ChartData `json:"domain,omitempty"`
Series *ChartData `json:"series,omitempty"`
LegendPosition string `json:"legendPosition,omitempty"`
PieHole float64 `json:"pieHole,omitempty"`
}
PieChartSpec is a pie or doughnut.
type PivotGroup ¶ added in v0.4.0
type PivotGroup struct {
SourceColumnOffset int `json:"sourceColumnOffset"`
ShowTotals bool `json:"showTotals,omitempty"`
SortOrder string `json:"sortOrder,omitempty"`
Label string `json:"label,omitempty"`
}
PivotGroup is one row or column grouping.
SortOrder is not optional in practice: a group without one is refused with "No sort order specified" (spike M), so every group this server builds carries one.
type PivotTable ¶ added in v0.4.0
type PivotTable struct {
Source *GridRange `json:"source,omitempty"`
Rows []*PivotGroup `json:"rows,omitempty"`
Columns []*PivotGroup `json:"columns,omitempty"`
Values []*PivotValue `json:"values,omitempty"`
ValueLayout string `json:"valueLayout,omitempty"`
}
PivotTable is a pivot this server builds from nothing, for add.
type PivotValue ¶ added in v0.4.0
type PivotValue struct {
SourceColumnOffset int `json:"sourceColumnOffset"`
SummarizeFunction string `json:"summarizeFunction,omitempty"`
Name string `json:"name,omitempty"`
}
PivotValue is one summarised column.
type ProtectedRange ¶
type ProtectedRange struct {
ProtectedRangeID int `json:"protectedRangeId,omitempty"`
Range *GridRange `json:"range,omitempty"`
NamedRangeID string `json:"namedRangeId,omitempty"`
Description string `json:"description,omitempty"`
WarningOnly bool `json:"warningOnly,omitempty"`
RequestingUserCanEdit bool `json:"requestingUserCanEdit,omitempty"`
Editors *Editors `json:"editors,omitempty"`
UnprotectedRanges []*GridRange `json:"unprotectedRanges,omitempty"`
}
ProtectedRange refuses edits from accounts that are not editors.
type RandomizeRangeRequest ¶ added in v0.2.0
type RandomizeRangeRequest struct {
Range *GridRange `json:"range,omitempty"`
}
RandomizeRangeRequest shuffles the rows of a rectangle.
type RefreshDataSourceObjectExecutionStatus ¶ added in v0.4.0
type RefreshDataSourceObjectExecutionStatus struct {
DataExecutionStatus *DataExecutionStatus `json:"dataExecutionStatus,omitempty"`
}
RefreshDataSourceObjectExecutionStatus is how one object's refresh went.
type RefreshDataSourceReply ¶ added in v0.4.0
type RefreshDataSourceReply struct {
Statuses []*RefreshDataSourceObjectExecutionStatus `json:"statuses,omitempty"`
}
RefreshDataSourceReply carries one status per object refreshed.
type RefreshDataSourceRequest ¶ added in v0.4.0
type RefreshDataSourceRequest struct {
DataSourceID string `json:"dataSourceId,omitempty"`
IsAll bool `json:"isAll,omitempty"`
Force bool `json:"force,omitempty"`
}
RefreshDataSourceRequest re-runs a source's query.
type RepeatCellRequest ¶ added in v0.2.0
type RepeatCellRequest struct {
Range *GridRange `json:"range,omitempty"`
Cell *CellData `json:"cell,omitempty"`
Fields string `json:"fields,omitempty"`
}
RepeatCellRequest writes one cell's fields across a rectangle. It is the workhorse of format_cells: a number format, a font, a background, an alignment and a note are all one of these with a different mask.
type Reply ¶ added in v0.1.0
type Reply struct {
AddSheet *AddSheetReply `json:"addSheet,omitempty"`
DuplicateSheet *DuplicateSheetReply `json:"duplicateSheet,omitempty"`
AddNamedRange *AddNamedRangeReply `json:"addNamedRange,omitempty"`
AddProtectedRange *AddProtectedRangeReply `json:"addProtectedRange,omitempty"`
AddTable *AddTableReply `json:"addTable,omitempty"`
AddBanding *AddBandingReply `json:"addBanding,omitempty"`
DeleteConditionalFormatRule *DeleteConditionalFormatRuleReply `json:"deleteConditionalFormatRule,omitempty"`
FindReplace *FindReplaceReply `json:"findReplace,omitempty"`
TrimWhitespace *TrimWhitespaceReply `json:"trimWhitespace,omitempty"`
DeleteDuplicates *DeleteDuplicatesReply `json:"deleteDuplicates,omitempty"`
CreateDeveloperMetadata *CreateDeveloperMetadataReply `json:"createDeveloperMetadata,omitempty"`
UpdateDeveloperMetadata *UpdateDeveloperMetadataReply `json:"updateDeveloperMetadata,omitempty"`
DeleteDeveloperMetadata *DeleteDeveloperMetadataReply `json:"deleteDeveloperMetadata,omitempty"`
AddChart *AddChartReply `json:"addChart,omitempty"`
AddSlicer *AddSlicerReply `json:"addSlicer,omitempty"`
UpdateEmbeddedObjectPosition *UpdateEmbeddedObjectPositionReply `json:"updateEmbeddedObjectPosition,omitempty"`
AddDataSource *AddDataSourceReply `json:"addDataSource,omitempty"`
RefreshDataSource *RefreshDataSourceReply `json:"refreshDataSource,omitempty"`
}
Reply is one member of the reply union, in the same order as the requests. Only the replies this server reads are here.
type Request ¶ added in v0.1.0
type Request struct {
AddSheet *AddSheetRequest `json:"addSheet,omitempty"`
DeleteSheet *DeleteSheetRequest `json:"deleteSheet,omitempty"`
DuplicateSheet *DuplicateSheetRequest `json:"duplicateSheet,omitempty"`
UpdateSheetProperties *UpdateSheetPropertiesRequest `json:"updateSheetProperties,omitempty"`
InsertDimension *InsertDimensionRequest `json:"insertDimension,omitempty"`
DeleteDimension *DeleteDimensionRequest `json:"deleteDimension,omitempty"`
MoveDimension *MoveDimensionRequest `json:"moveDimension,omitempty"`
UpdateDimensionProperties *UpdateDimensionPropertiesRequest `json:"updateDimensionProperties,omitempty"`
AutoResizeDimensions *AutoResizeDimensionsRequest `json:"autoResizeDimensions,omitempty"`
AddDimensionGroup *DimensionGroupRequest `json:"addDimensionGroup,omitempty"`
DeleteDimensionGroup *DimensionGroupRequest `json:"deleteDimensionGroup,omitempty"`
// Phase 2: formatting, the objects attached to a range, and the
// transforms that move data without the caller naming its address.
RepeatCell *RepeatCellRequest `json:"repeatCell,omitempty"`
UpdateBorders *UpdateBordersRequest `json:"updateBorders,omitempty"`
MergeCells *MergeCellsRequest `json:"mergeCells,omitempty"`
UnmergeCells *UnmergeCellsRequest `json:"unmergeCells,omitempty"`
AddNamedRange *AddNamedRangeRequest `json:"addNamedRange,omitempty"`
UpdateNamedRange *UpdateNamedRangeRequest `json:"updateNamedRange,omitempty"`
DeleteNamedRange *DeleteNamedRangeRequest `json:"deleteNamedRange,omitempty"`
AddProtectedRange *AddProtectedRangeRequest `json:"addProtectedRange,omitempty"`
UpdateProtectedRange *UpdateProtectedRangeRequest `json:"updateProtectedRange,omitempty"`
DeleteProtectedRange *DeleteProtectedRangeRequest `json:"deleteProtectedRange,omitempty"`
SetDataValidation *SetDataValidationRequest `json:"setDataValidation,omitempty"`
AddTable *AddTableRequest `json:"addTable,omitempty"`
UpdateTable *UpdateTableRequest `json:"updateTable,omitempty"`
DeleteTable *DeleteTableRequest `json:"deleteTable,omitempty"`
AddBanding *AddBandingRequest `json:"addBanding,omitempty"`
UpdateBanding *UpdateBandingRequest `json:"updateBanding,omitempty"`
DeleteBanding *DeleteBandingRequest `json:"deleteBanding,omitempty"`
AddConditionalFormatRule *AddConditionalFormatRuleRequest `json:"addConditionalFormatRule,omitempty"`
UpdateConditionalFormatRule *UpdateConditionalFormatRuleRequest `json:"updateConditionalFormatRule,omitempty"`
DeleteConditionalFormatRule *DeleteConditionalFormatRuleRequest `json:"deleteConditionalFormatRule,omitempty"`
SortRange *SortRangeRequest `json:"sortRange,omitempty"`
FindReplace *FindReplaceRequest `json:"findReplace,omitempty"`
TrimWhitespace *TrimWhitespaceRequest `json:"trimWhitespace,omitempty"`
DeleteDuplicates *DeleteDuplicatesRequest `json:"deleteDuplicates,omitempty"`
TextToColumns *TextToColumnsRequest `json:"textToColumns,omitempty"`
RandomizeRange *RandomizeRangeRequest `json:"randomizeRange,omitempty"`
AutoFill *AutoFillRequest `json:"autoFill,omitempty"`
CopyPaste *CopyPasteRequest `json:"copyPaste,omitempty"`
CutPaste *CutPasteRequest `json:"cutPaste,omitempty"`
// Phase 3: developer metadata, the durable anchors of §6.4.
CreateDeveloperMetadata *CreateDeveloperMetadataRequest `json:"createDeveloperMetadata,omitempty"`
UpdateDeveloperMetadata *UpdateDeveloperMetadataRequest `json:"updateDeveloperMetadata,omitempty"`
DeleteDeveloperMetadata *DeleteDeveloperMetadataRequest `json:"deleteDeveloperMetadata,omitempty"`
// Phase 4: charts, slicers and pivot tables. A pivot table has no
// request of its own — it is a field of a cell, so it goes through
// updateCells like any other cell write.
AddChart *AddChartRequest `json:"addChart,omitempty"`
UpdateChartSpec *UpdateChartSpecRequest `json:"updateChartSpec,omitempty"`
AddSlicer *AddSlicerRequest `json:"addSlicer,omitempty"`
UpdateSlicerSpec *UpdateSlicerSpecRequest `json:"updateSlicerSpec,omitempty"`
DeleteEmbeddedObject *DeleteEmbeddedObjectRequest `json:"deleteEmbeddedObject,omitempty"`
UpdateEmbeddedObjectPosition *UpdateEmbeddedObjectPositionRequest `json:"updateEmbeddedObjectPosition,omitempty"`
UpdateCells *UpdateCellsRequest `json:"updateCells,omitempty"`
// Connected Sheets, behind GSHEETS_ENABLE_DATA_SOURCES (§17.6a).
AddDataSource *AddDataSourceRequest `json:"addDataSource,omitempty"`
RefreshDataSource *RefreshDataSourceRequest `json:"refreshDataSource,omitempty"`
CancelDataSourceRefresh *CancelDataSourceRefreshRequest `json:"cancelDataSourceRefresh,omitempty"`
DeleteDataSource *DeleteDataSourceRequest `json:"deleteDataSource,omitempty"`
}
Request is one member of the batchUpdate union. The API has 69; this is the set phase 1 builds, and each later phase adds its own rather than the whole union arriving as free-form maps.
Exactly one field is set. Nothing here accepts a raw map: a typed builder is what stops a request being sent that no code has read.
type RowData ¶
type RowData struct {
Values []*CellData `json:"values,omitempty"`
}
RowData is one row of a GridData. Trailing empty cells are omitted by the API, so a row may be shorter than the range asked for.
type SearchDeveloperMetadataRequest ¶ added in v0.3.0
type SearchDeveloperMetadataRequest struct {
DataFilters []*DataFilter `json:"dataFilters,omitempty"`
}
SearchDeveloperMetadataRequest is the body of developerMetadata.search — a POST that only reads (§11).
type SearchDeveloperMetadataResponse ¶ added in v0.3.0
type SearchDeveloperMetadataResponse struct {
MatchedDeveloperMetadata []*MatchedDeveloperMetadata `json:"matchedDeveloperMetadata,omitempty"`
}
SearchDeveloperMetadataResponse is what it answers with.
type SetDataValidationRequest ¶ added in v0.2.0
type SetDataValidationRequest struct {
Range *GridRange `json:"range,omitempty"`
Rule *DataValidationRule `json:"rule,omitempty"`
}
SetDataValidationRequest puts a rule on a rectangle, or clears it when the rule is absent.
type Sheet ¶
type Sheet struct {
Properties *SheetProperties `json:"properties,omitempty"`
Data []*GridData `json:"data,omitempty"`
Merges []*GridRange `json:"merges,omitempty"`
ProtectedRanges []*ProtectedRange `json:"protectedRanges,omitempty"`
FilterViews []*FilterView `json:"filterViews,omitempty"`
Tables []*Table `json:"tables,omitempty"`
Charts []*EmbeddedChart `json:"charts,omitempty"`
Slicers []*Slicer `json:"slicers,omitempty"`
BandedRanges []*BandedRange `json:"bandedRanges,omitempty"`
ConditionalFormats []*ConditionalFormatRule `json:"conditionalFormats,omitempty"`
}
Sheet is one tab.
type SheetProperties ¶
type SheetProperties struct {
SheetID int `json:"sheetId"`
Title string `json:"title,omitempty"`
Index *int `json:"index,omitempty"`
SheetType string `json:"sheetType,omitempty"`
GridProperties *GridProperties `json:"gridProperties,omitempty"`
Hidden bool `json:"hidden,omitempty"`
RightToLeft bool `json:"rightToLeft,omitempty"`
TabColorStyle *ColorStyle `json:"tabColorStyle,omitempty"`
}
SheetProperties describe one tab.
Index is a pointer because the API's field is optional and the zero value means "first", not "unset": an addSheet carrying index 0 puts the new tab at the front of the spreadsheet. A struct that cannot express "leave it where Google would put it" is how a sheet lands in the wrong place with nobody having asked for it.
type Slicer ¶ added in v0.4.0
type Slicer struct {
SlicerID int `json:"slicerId,omitempty"`
Spec *SlicerSpec `json:"spec,omitempty"`
Position *EmbeddedObjectPosition `json:"position,omitempty"`
}
Slicer is a slicer as it comes back from a read.
type SlicerSpec ¶ added in v0.4.0
type SlicerSpec struct {
DataRange *GridRange `json:"dataRange,omitempty"`
ColumnIndex int `json:"columnIndex,omitempty"`
Title string `json:"title,omitempty"`
}
SlicerSpec is a slicer's definition. Unlike a chart's, it is small and closed enough to model: one data range, one column, a title.
type SortRangeRequest ¶ added in v0.2.0
type SortRangeRequest struct {
Range *GridRange `json:"range,omitempty"`
SortSpecs []*SortSpec `json:"sortSpecs,omitempty"`
}
SortRangeRequest sorts a rectangle in place.
type SortSpec ¶ added in v0.2.0
type SortSpec struct {
DimensionIndex int `json:"dimensionIndex"`
SortOrder string `json:"sortOrder,omitempty"`
}
SortSpec is one column of a sort, in the API's zero-based numbering.
type SourceAndDestination ¶ added in v0.2.0
type SourceAndDestination struct {
Source *GridRange `json:"source,omitempty"`
Dimension string `json:"dimension,omitempty"`
FillLength int `json:"fillLength"`
}
SourceAndDestination is autofill's explicit form.
type Spreadsheet ¶
type Spreadsheet struct {
SpreadsheetID string `json:"spreadsheetId,omitempty"`
Properties *SpreadsheetProperties `json:"properties,omitempty"`
Sheets []*Sheet `json:"sheets,omitempty"`
NamedRanges []*NamedRange `json:"namedRanges,omitempty"`
SpreadsheetURL string `json:"spreadsheetUrl,omitempty"`
// DataSources are the Connected Sheets sources. The card asks for
// them whatever the configuration: the field mask is accepted under
// the ordinary scopes and returns nothing where there are none, so
// reporting that a spreadsheet has one costs no scope and no consent
// (§17.6a).
DataSources []*DataSource `json:"dataSources,omitempty"`
}
Spreadsheet is the spreadsheets.get response.
type SpreadsheetProperties ¶
type SpreadsheetProperties struct {
Title string `json:"title,omitempty"`
Locale string `json:"locale,omitempty"`
AutoRecalc string `json:"autoRecalc,omitempty"`
TimeZone string `json:"timeZone,omitempty"`
}
SpreadsheetProperties are the file-wide settings.
type Table ¶
type Table struct {
TableID string `json:"tableId,omitempty"`
Name string `json:"name,omitempty"`
Range *GridRange `json:"range,omitempty"`
ColumnProperties []*TableColumn `json:"columnProperties,omitempty"`
}
Table is a native Sheets table.
type TableColumn ¶
type TableColumn struct {
ColumnIndex int `json:"columnIndex,omitempty"`
ColumnName string `json:"columnName,omitempty"`
ColumnType string `json:"columnType,omitempty"`
}
TableColumn is one column of a table.
type TextFormat ¶ added in v0.2.0
type TextFormat struct {
ForegroundColorStyle *ColorStyle `json:"foregroundColorStyle,omitempty"`
FontFamily string `json:"fontFamily,omitempty"`
FontSize int `json:"fontSize,omitempty"`
Bold bool `json:"bold,omitempty"`
Italic bool `json:"italic,omitempty"`
Strikethrough bool `json:"strikethrough,omitempty"`
Underline bool `json:"underline,omitempty"`
}
TextFormat is a cell's font.
The booleans have no pointer and no "unset". A request names the fields it changes in its own mask — "userEnteredFormat.textFormat.bold" — and a field named in the mask and absent from the body is set to its default, which is how bold is turned off. So "leave it alone" is expressed by leaving it out of the mask, and the caller's three-way choice lives in the tool's input rather than here.
type TextToColumnsRequest ¶ added in v0.2.0
type TextToColumnsRequest struct {
Source *GridRange `json:"source,omitempty"`
Delimiter string `json:"delimiter,omitempty"`
DelimiterType string `json:"delimiterType,omitempty"`
}
TextToColumnsRequest splits one column into several.
type TrimWhitespaceReply ¶ added in v0.2.0
type TrimWhitespaceReply struct {
CellsChangedCount int `json:"cellsChangedCount,omitempty"`
}
TrimWhitespaceReply counts the cells it changed.
type TrimWhitespaceRequest ¶ added in v0.2.0
type TrimWhitespaceRequest struct {
Range *GridRange `json:"range,omitempty"`
}
TrimWhitespaceRequest strips leading, trailing and repeated spaces.
type UnmergeCellsRequest ¶ added in v0.2.0
type UnmergeCellsRequest struct {
Range *GridRange `json:"range,omitempty"`
}
UnmergeCellsRequest splits every merge the rectangle covers.
type UpdateBandingRequest ¶ added in v0.2.0
type UpdateBandingRequest struct {
BandedRange *BandedRange `json:"bandedRange,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateBandingRequest changes one.
type UpdateBordersRequest ¶ added in v0.2.0
type UpdateBordersRequest struct {
Range *GridRange `json:"range,omitempty"`
Top *Border `json:"top,omitempty"`
Bottom *Border `json:"bottom,omitempty"`
Left *Border `json:"left,omitempty"`
Right *Border `json:"right,omitempty"`
InnerHorizontal *Border `json:"innerHorizontal,omitempty"`
InnerVertical *Border `json:"innerVertical,omitempty"`
}
UpdateBordersRequest draws the edges of a rectangle. Separate from a cell format because the inner edges belong to the rectangle rather than to any one cell.
A nil edge is left alone; an edge set to style NONE is erased. That is the API's own rule and the reason "none" is a border style here.
type UpdateCellsRequest ¶ added in v0.4.0
type UpdateCellsRequest struct {
Start *GridCoordinate `json:"start,omitempty"`
Range *GridRange `json:"range,omitempty"`
Rows []*RowData `json:"rows,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateCellsRequest writes cells. Fields is a CellData field mask, and the API requires at least one: `pivotTable` alone writes a pivot and disturbs nothing else in the cell.
Range and Start are alternatives. Start is one corner and lets the rows decide how far the write reaches, which is what anchoring a pivot needs; Range clears the fields named across the whole rectangle where the rows do not cover it.
type UpdateChartSpecRequest ¶ added in v0.4.0
type UpdateChartSpecRequest struct {
ChartID int `json:"chartId"`
Spec json.RawMessage `json:"spec,omitempty"`
}
UpdateChartSpecRequest replaces a chart's spec whole. Raw, because what goes back is what was read plus the edit.
type UpdateConditionalFormatRuleRequest ¶ added in v0.2.0
type UpdateConditionalFormatRuleRequest struct {
Rule *ConditionalFormatRule `json:"rule,omitempty"`
Index int `json:"index"`
// SheetID is required when the rule is being moved rather than
// replaced; this server only replaces, so it names the sheet the
// index counts within.
SheetID int `json:"sheetId"`
}
UpdateConditionalFormatRuleRequest replaces the rule at an index.
type UpdateDeveloperMetadataReply ¶ added in v0.3.0
type UpdateDeveloperMetadataReply struct {
DeveloperMetadata []*DeveloperMetadata `json:"developerMetadata,omitempty"`
}
UpdateDeveloperMetadataReply lists what changed.
type UpdateDeveloperMetadataRequest ¶ added in v0.3.0
type UpdateDeveloperMetadataRequest struct {
DataFilters []*DataFilter `json:"dataFilters,omitempty"`
DeveloperMetadata *DeveloperMetadata `json:"developerMetadata,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateDeveloperMetadataRequest changes every entry its filters match.
type UpdateDimensionPropertiesRequest ¶ added in v0.1.0
type UpdateDimensionPropertiesRequest struct {
Range *DimensionRange `json:"range,omitempty"`
Properties *DimensionProperties `json:"properties,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateDimensionPropertiesRequest resizes or hides a band.
type UpdateEmbeddedObjectPositionReply ¶ added in v0.4.0
type UpdateEmbeddedObjectPositionReply struct {
Position *EmbeddedObjectPosition `json:"position,omitempty"`
}
UpdateEmbeddedObjectPositionReply carries where it ended up.
type UpdateEmbeddedObjectPositionRequest ¶ added in v0.4.0
type UpdateEmbeddedObjectPositionRequest struct {
ObjectID int `json:"objectId"`
NewPosition *EmbeddedObjectPosition `json:"newPosition,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateEmbeddedObjectPositionRequest moves or resizes a chart.
Fields is required: the API refuses the request without it rather than treating it as "everything given" (spike L).
type UpdateNamedRangeRequest ¶ added in v0.2.0
type UpdateNamedRangeRequest struct {
NamedRange *NamedRange `json:"namedRange,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateNamedRangeRequest moves or renames one.
type UpdateProtectedRangeRequest ¶ added in v0.2.0
type UpdateProtectedRangeRequest struct {
ProtectedRange *ProtectedRange `json:"protectedRange,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateProtectedRangeRequest changes one.
type UpdateSheetPropertiesRequest ¶ added in v0.1.0
type UpdateSheetPropertiesRequest struct {
Properties *SheetProperties `json:"properties,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateSheetPropertiesRequest changes the fields its mask names, and only those. An empty mask changes nothing, which the API treats as an error rather than a no-op.
type UpdateSlicerSpecRequest ¶ added in v0.4.0
type UpdateSlicerSpecRequest struct {
SlicerID int `json:"slicerId"`
Spec *SlicerSpec `json:"spec,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateSlicerSpecRequest replaces a slicer's spec.
Fields is required, exactly as it is on the embedded-object move: "At least one field must be specified". The comment on the builder said this server set one for three hours while the struct had no such field — a claim in prose that the code did not make, and every unit test passed because the fake did not require it either. The live run refused the first slicer update it was given.
type UpdateTableRequest ¶ added in v0.2.0
type UpdateTableRequest struct {
Table *Table `json:"table,omitempty"`
Fields string `json:"fields,omitempty"`
}
UpdateTableRequest changes one.
type UpdateValuesResponse ¶ added in v0.1.0
type UpdateValuesResponse struct {
SpreadsheetID string `json:"spreadsheetId,omitempty"`
UpdatedRange string `json:"updatedRange,omitempty"`
UpdatedRows int `json:"updatedRows,omitempty"`
UpdatedColumns int `json:"updatedColumns,omitempty"`
UpdatedCells int `json:"updatedCells,omitempty"`
UpdatedData *ValueRange `json:"updatedData,omitempty"`
}
UpdateValuesResponse is what values.update returns, and what each entry of a values.batchUpdate response carries.
UpdatedData is present only when the request asked for the values back, which every write here does: it is the half the coercion report is built from (§4.4).
type ValueRange ¶
type ValueRange struct {
Range string `json:"range,omitempty"`
MajorDimension string `json:"majorDimension,omitempty"`
Values [][]any `json:"values,omitempty"`
}
ValueRange is one range of values, as spreadsheets.values.* speaks it.