spreadsheet

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2019 License: MIT Imports: 10 Imported by: 0

README

tamate-spreadsheet

LICENSE GoDoc Go Report Card

CircleCI

A Spreadsheet-Driver for go-tamate/tamate package



Features

  • Column's row index make valiable
  • Setting ignore row

Requirements

  • Go 1.12 or higher. We aim to support the 3 latest versions of Go.

Installation

Simple install the package to your $GOPATH with the go tool from shell:

$ go get -u github.com/go-tamate/tamate-spreadsheet

Make sure Git is installed on your machine and in your system's PATH.

Usage

Tamate Driver is an implementation of tamate/driver interface.

Use spreadsheet as driverName and a valid DSN as dataSourceName:

import  "github.com/go-tamate/tamate"
import  _ "github.com/go-tamate/tamate-spreadsheet"

ds, err := tamate.Open("spreadseet", "xxxxxxxxxxxx")

Use this to Get, Set, GettingDiff, etc.

DSN (Data Source Name)
Sheet ID
https://docs.google.com/spreadsheets/d/xxxxxxxxxxxx
Credential Data
  1. Create ServiceAccount at Google Cloud Console.

  2. Getting credential file from Google Cloud Console.

  3. Allow ServiceAccount to access spreadsheet. For example add ServiceAccount's email address to sharer.

  4. Setting credential file path or credential data to env as TAMATE_SPREADSHEET_CREDENTIAL_FILE_PATH or TAMATE_SPREADSHEET_CREDENTIAL_DATA.

Testing / Development

Please execute the following command at the root of the project

docker-compose up -d
go test ./...
docker-compose down

License

Documentation

Index

Constants

View Source
const (
	KeyCredentialFilePath = "TAMATE_SPREADSHEET_CREDENTIAL_FILE_PATH"
	KeyCredentialData     = "TAMATE_SPREADSHEET_CREDENTIAL_DATA"
	KeySheetId            = "TAMATE_SPREADSHEET_SHEET_ID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SpreadsheetConn

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

func (*SpreadsheetConn) Close

func (c *SpreadsheetConn) Close() error

func (*SpreadsheetConn) GetRows

func (c *SpreadsheetConn) GetRows(ctx context.Context, sheetName string) ([]*driver.Row, error)

func (*SpreadsheetConn) GetSchema

func (c *SpreadsheetConn) GetSchema(ctx context.Context, sheetName string) (*driver.Schema, error)

func (*SpreadsheetConn) SetRows

func (c *SpreadsheetConn) SetRows(ctx context.Context, sheetName string, rows []*driver.Row) error

func (*SpreadsheetConn) SetSchema

func (c *SpreadsheetConn) SetSchema(ctx context.Context, sheetName string, schema *driver.Schema) error

type SpreadsheetService

type SpreadsheetService interface {
	Ping(context.Context, string) error
	GetValues(context.Context, string, ...string) ([]*sheets.ValueRange, error)
	SetValues(context.Context, string, ...*sheets.ValueRange) error
	ClearValues(context.Context, string, ...string) error
}

Jump to

Keyboard shortcuts

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