A Wrapper Client for Google Spreadsheet API (Sheets API)

Overview

Senmai

A Wrapper Client for Google Spreadsheet API (Sheets API)

PREPARATION

Service Account and Key File

  1. Create a service account on Google Cloud Platform. Refer: https://cloud.google.com/iam/docs/creating-managing-service-accounts
  2. Generate and Download a key file (json) that relates the service account you created. Refer: https://cloud.google.com/iam/docs/creating-managing-service-account-keys

Sheets API

  1. Enable Sheets API on your project. Refer: https://console.developers.google.com/apis/api/sheets.googleapis.com/overview

Spreadsheet

  1. Create a spreadsheet on your google drive.
  2. Specify your table schema on the spreadsheet. Row '1' is column name cell. And rows '2' or greater are data cell. Cell '1A' must be 'id'.
  3. Invite the service account as a editor, without notification.

SYNOPSIS

Init Senmai Client

	// KeyFile path of your key file you generated at PREPARATION section 
	const KeyFile = "/path/to/identity.json"

	// SpreadsheetID is identity string of spreadsheet that you want to manipulate. Refer: https://developers.google.com/sheets/api/guides/concepts
	const SpreadsheetID = "1234567890qwertyuiopASDFGHJKL"

	// SheetName is a name of a sheet you want to manipulate 
	SheetName = "book"

	// Init Senmai Client
	sm, err := senmai.New(KeyFile)
	if err != nil {
		log.Fatal(err.Error())
	}

Get Table struct

	// Get Table struct that named "book"
	book, err := sm.GetTable(SpreadsheetID, SheetName)
	if err != nil {
		log.Fatal(err.Error())
	}

Fetch a row

	// Fetch
	row, err := book.FetchRow("mybook0001")
	if err != nil {
		log.Fatal(err.Error())
	}
	fmt.Printf("%#v\n", row)

Update a row

	// Update
	row.Cols["price_yen"] = "4000"
	err = row.Update()
	if err != nil {
		log.Fatal(err.Error())
	}

Create a new row

	// Build a new row struct
	b1 := book.NewRow()

	// Fill-in field values
	b1.Cols = map[string]string{
		"id":         "mybook0003",
		"name":       "Slack: Getting Past Burnout, Busywork, and the Myth of Total Efficiency",
		"author":     "Tom DeMarco",
		"price_yen":  "2800",
	}

	// Insert into spreadsheet
	err = b1.Insert()
	if err != nil {
		log.Fatal(err.Error())
	}
Owner
ytnobody / satoshi azuma
ytnobody / satoshi azuma
Sync your bank transactions with google sheets using Open Banking APIs

this is a markdown version of the copy on the site landing page: https://youneedaspreadsheet.com You need a spreadsheet ?? Get on top of your finances

Alex Russell-Saw 29 May 10, 2022
Correct the timestamp of photo/video of Google Photo from Google takeout

Correct Timestamp of Google Photo from Google Takeout Development Environment: Ubuntu 20.04 Go 1.17 Usage Require Go 1.16 or later to build. go build

Siong-Ui Te (戴上為) 0 Dec 2, 2021
⚡️ SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang)

Gosip - SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang) Main features Unattended authentication using different strategies

Andrew Koltyakov 73 May 10, 2022
Clusterpedia-client - clusterpedia-client supports the use of native client-go mode to call the clusterpedia API

clusterpedia-client supports the use of native client-go mode to call the cluste

Calvin Chen 4 Jan 7, 2022
Client-go - Clusterpedia-client supports the use of native client-go mode to call the clusterpedia API

clusterpedia-client supports the use of native client-go mode to call the cluste

clusterpedia.io 7 Apr 19, 2022
Google Cloud Client Libraries for Go.

Google Cloud Client Libraries for Go Go packages for Google Cloud Platform services. import "cloud.google.com/go" To install the packages on your syst

Google APIs 2.9k May 11, 2022
A Go client implementing a client-side distributed consumer group client for Amazon Kinesis.

Kinesumer is a Go client implementing a client-side distributed consumer group client for Amazon Kinesis.

당근마켓 62 May 12, 2022
The NVD API is an unofficial Go wrapper around the NVD API.

NVD API The NVD API is an unofficial Go wrapper around the NVD API. Supports: CVE CPE How to use The following shows how to basically use the wrapper

Lucas TESSON 3 May 9, 2022
A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

null 1 Mar 5, 2022
Google Adwords API for Go

gads Package gads provides a wrapper for the Google Adwords SOAP API. installation go get github.com/emiddleton/gads setup In order to access the API

Edward Middleton 49 Dec 4, 2021
Unofficial Google Trends API for Go

Google Trends API for Go Unofficial Google Trends API for Golang gogtrends is API wrapper which allows to get reports from Google Trends. All contribu

Max Ivanov 64 May 12, 2022
Google Maps API checker

GAP Google API checker. Based on the study Unauthorized Google Maps API Key Usage Cases, and Why You Need to Care and Google Maps API (Not the Key) Bu

Joan Bono 42 Jan 1, 2022
Use Google REST api to extract your personal Photo Library

Photo Go A better approach to extracting your photos from Google to your personal cloud. I'm moving my photos out of Google to a Synology NAS. create

James 2 Dec 7, 2021
GoDrive is a Go CLI tool written to wrap the Google Drive API.

GoDrive is a Go CLI tool written to wrap the Google Drive API.

Leonardo Araujo 0 Jan 10, 2022
Simple translation tool using google translation api.

Translator Simple translation tool using google translation api. To use it you have to provide a valid service account as json file with path in the e

eric regnier 0 Feb 1, 2022
Simple golang airtable API wrapper

Golang Airtable API A simple #golang package to access the Airtable API. Table of contents Golang Airtable API Table of contents Installation Basic us

mehanizm 37 Mar 21, 2022
This is a Golang wrapper for working with TMDb API. It aims to support version 3.

This is a Golang wrapper for working with TMDb API. It aims to support version 3. An API Key is required. To register for one, head over to themoviedb

Cyro Dubeux 52 May 18, 2022
Trello API wrapper for Go

Go Trello API A #golang package to access the Trello API. Nearly 100% of the read-only surface area of the API is covered, as is creation and modifica

Aaron Longwell 199 Apr 13, 2022
null 86 May 3, 2022