sheets

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColFileID = iota
	ColName
	ColFolderPath
	ColMimeType
	ColWebViewLink
	ColModifiedTime
	ColContents
	ColBrief
	ColCategory
	ColTags
	ColReorganizePath
	ColSyncedAt
	ColCount
)

Column indices for Google Sheets.

View Source
const MaxCellLength = 50000

Variables

This section is empty.

Functions

This section is empty.

Types

type Pusher

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

Pusher handles pushing data to Google Sheets.

func NewPusher

func NewPusher(client SheetsClient, sheetID string) *Pusher

NewPusher creates a new Pusher instance.

func (*Pusher) EnsureHeaders

func (p *Pusher) EnsureHeaders(ctx context.Context) error

EnsureHeaders ensures that the sheet has the correct headers.

func (*Pusher) FetchEnrichment

func (p *Pusher) FetchEnrichment(ctx context.Context) ([]SheetRow, error)

FetchEnrichment fetches all rows from the sheet to get enrichment data.

func (*Pusher) Headers

func (p *Pusher) Headers() []string

Headers returns the default headers for the sheet.

func (*Pusher) Push

func (p *Pusher) Push(ctx context.Context, rows []SheetRow) error

Push pushes a list of SheetRows to the sheet, updating existing ones and appending new ones.

type SheetRow

type SheetRow struct {
	FileID         string
	Name           string
	FolderPath     string
	MimeType       string
	WebViewLink    string
	ModifiedTime   string
	Contents       string
	Brief          string
	Category       string
	Tags           string
	ReorganizePath string
	SyncedAt       string
}

SheetRow represents a row in the Google Sheets index.

func FromValues

func FromValues(values []string) SheetRow

FromValues populates a SheetRow from a slice of strings.

func (SheetRow) ToValues

func (r SheetRow) ToValues() []string

ToValues converts the SheetRow to a slice of strings for Google Sheets.

type SheetsClient

type SheetsClient interface {
	SheetsGetValues(ctx context.Context, sheetID string, cellRange string) ([][]string, error)
	SheetsUpdate(ctx context.Context, sheetID string, cellRange string, values [][]string) error
	SheetsAppend(ctx context.Context, sheetID string, cellRange string, values [][]string) error
}

SheetsClient defines the interface for Google Sheets operations.

Jump to

Keyboard shortcuts

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