Documentation
¶
Index ¶
- func IsAuthError(err error) bool
- type File
- type Gog
- func (g *Gog) AuthList(ctx context.Context) ([]string, error)
- func (g *Gog) DocsCat(ctx context.Context, fileID string) (string, error)
- func (g *Gog) DriveDownload(ctx context.Context, fileID string, format string) ([]byte, error)
- func (g *Gog) DriveDownloadToFile(ctx context.Context, fileID string, format string, outputPath string) error
- func (g *Gog) DriveLs(ctx context.Context, parentID string) ([]File, error)
- func (g *Gog) DriveMkdir(ctx context.Context, name string, parentID string) (string, error)
- func (g *Gog) DriveSearch(ctx context.Context, query string) ([]File, error)
- func (g *Gog) SheetsAppend(ctx context.Context, sheetID string, cellRange string, values [][]string) error
- func (g *Gog) SheetsCreate(ctx context.Context, title string, parentID string) (string, error)
- func (g *Gog) SheetsGet(ctx context.Context, sheetID string) (string, error)
- func (g *Gog) SheetsGetValues(ctx context.Context, sheetID string, cellRange string) ([][]string, error)
- func (g *Gog) SheetsMetadata(ctx context.Context, sheetID string) (*SpreadsheetMetadata, error)
- func (g *Gog) SheetsUpdate(ctx context.Context, sheetID string, cellRange string, values [][]string) error
- type Sheet
- type SheetProperties
- type SpreadsheetMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAuthError ¶
IsAuthError checks if the error is a gog authentication error (exit status 4).
Types ¶
type File ¶
type File struct {
ID string `json:"id"`
Name string `json:"name"`
MimeType string `json:"mimeType"`
Parents []string `json:"parents"`
ModifiedTime string `json:"modifiedTime"`
Size int64 `json:"size,string,omitempty"`
WebViewLink string `json:"webViewLink"`
}
File represents a simplified Google Drive file structure returned by gog.
type Gog ¶
type Gog struct {
Account string
}
Gog is a wrapper for the gog CLI.
func (*Gog) AuthList ¶
AuthList returns a list of authenticated Google accounts from gog that have the required scopes (drive and sheets).
func (*Gog) DriveDownload ¶
DriveDownload downloads a file from Google Drive and returns its content as bytes. WARNING: This function pipes binary content through stdout and is only safe for text-based export formats (e.g., format="txt", format="md"). For binary formats (docx, xlsx, pptx, pdf), use DriveDownloadToFile instead to avoid stdout corruption of binary content.
func (*Gog) DriveDownloadToFile ¶
func (g *Gog) DriveDownloadToFile(ctx context.Context, fileID string, format string, outputPath string) error
DriveDownloadToFile downloads a file from Google Drive to a specific path.
func (*Gog) DriveMkdir ¶
DriveMkdir creates a folder in Google Drive. It returns the ID of the created folder.
func (*Gog) DriveSearch ¶
DriveSearch searches for files matching a query.
func (*Gog) SheetsAppend ¶
func (g *Gog) SheetsAppend(ctx context.Context, sheetID string, cellRange string, values [][]string) error
SheetsAppend appends rows to a range in a Google Sheet using JSON values.
func (*Gog) SheetsCreate ¶
SheetsCreate creates a new Google Sheet. It returns the spreadsheet ID of the created sheet.
func (*Gog) SheetsGetValues ¶
func (g *Gog) SheetsGetValues(ctx context.Context, sheetID string, cellRange string) ([][]string, error)
SheetsGetValues returns values from a range in a Google Sheet as [][]string.
func (*Gog) SheetsMetadata ¶
SheetsMetadata returns metadata for a Google Spreadsheet.
type Sheet ¶
type Sheet struct {
Properties SheetProperties `json:"properties"`
}
Sheet represents a tab in a Google Spreadsheet.
type SheetProperties ¶
SheetProperties represents properties of a Google Sheet tab.
type SpreadsheetMetadata ¶
SpreadsheetMetadata represents metadata for a Google Spreadsheet.