WARNING: THIS IS VERY ALPHA VERSION. API OR CONFIGURATION COULD CHANGE.
Dump records to Google Sheets.
- Plugin type: output
- Load all or nothing: no
- Resume supported: no
- Cleanup supported: yes
- spreadsheet_id: Google Sheets' ID (string, required)
- if sheets url is
https://docs.google.com/spreadsheets/d/hoge/edit#gid=0
thenspreadsheet_id
ishoge
)
- if sheets url is
- sheet_name: Sheet Name (string, required)
- if sheet does not exist then create new sheet named
sheet_name
- if sheet does not exist then create new sheet named
- client_secrets_path: Path to client_secrets.json (string, required)
- credentials_path: Path to credential file (string, default:
~/.config/gcloud/embulk-output-gsheets.yml
) - application_name: Application name pass to Google (string, default:
embulk-output-gsheets
) - bulk_num: Bulk write number of records (integer, default: 200)
- with_header: Write header line (bool, default: true)
out:
type: gsheets
spreadsheet_id: SPREADSHEET_ID
sheet_name: SHEET_NAME
client_secrets_path: PATH_TO_CLIENT_SECRET_JSON_FILE
First, create API project from Google API Console if haven't create it. And then turn on Google Sheets API.
OAuth 2 is used to authorize this application. This library uses Google API Ruby Client for authentication and handling Google sheets.
First you create OAuth client and get client secret JSON from Google Cloud Console.
- Go to Google Cloud Console
- Click 'API Manager'
- Click 'Create Credentials'
- Click 'Create OAuth Client ID'
- Choose 'Other'
- Fill 'Application name'
- Get the client id and client secret
- Download client secret JSON from download button
Then client secret JSON install to your path. client_secrets_path
option use this path.
OAuth authorization requires when you run embulk-output-gsheets
at first time.
- 'Open the following URL in the browser and enter the resulting code after authorization' log and Authorization URL display on console
- Copy and paste authorization URL on browser address bar
- OAuth token displays if authorization success.
- Copy and paste OAuth token to console and hit enter key
I wrote utility that provides 'Get OAuth token from browser' section feature by Golang now. It can help preparing OAuth credentials file on multi-platforms.
This plugin doesn't release rubygems. So clone and build and install step requires.
# clone
$ git clone https://github.com/noissefnoc/embulk-output-gsheets.git
# build
$ cd embulk-output-gsheets
$ bundle install
$ bundle exec rake
# install
$ embulk gem install pkg/embulk-output-gsheets-0.1.0.gem
kataring/embulk-output-google_spreadsheets can also embulk-output plugin for Google Sheets.
embulk-output-google_spreadsheet | embulk-output-gsheets | |
---|---|---|
Language | Java | Ruby |
Authentication file | p12 | JSON |
Sheets API Version | 3 | 4 |
Latest version | v0.0.2 | - (under development) |
Mode | append | append(*1) |
Bulk write | No(*2) | yes(*3) |
- 1: intent to implement
truncate
andreplace
mode - 2: write once per record
- 3: write once per
bulk_num
option (default: 200)
This code is free to use under the terms of MIT licence.