spreadit
spreadit
is a simple CLI tool to write CSV data to Google Sheets.
Usage
spreadit --id <spreadsheet_id> --title <title> [--file <file>] [--range <range>] [--append]
Examples
# specify csv file
spreadit --file data.csv --id 1X2Y3Z4W5V6U7T8S9R0Q --title 'New Sheet'
# or pipe data
cat data.csv | spreadit --id 1X2Y3Z4W5V6U7T8S9R0Q --title 'New Sheet'
# or redirect into stdin
spreadit --id 1X2Y3Z4W5V6U7T8S9R0Q --title 'New Sheet' < data.csv
Options
Option |
Type |
Description |
Default |
--id -i |
string |
Spreadsheet ID |
|
--title -t |
string |
Sheet title |
|
--file -f |
string |
CSV file path. If not specified read from stdin (optional) |
|
--range -r |
string |
Range to write (optional) |
"A1" |
--append -a |
bool |
Append data to the end of the sheet (optional) |
false |
--format |
string |
Input format. csv or tsv (optional) |
"csv" |
--config |
string |
Config file path (optional) |
|
Config file
You can specify the default options in the config file.
# ~/.config/spreadit/.spreadit.yaml
id: 1X2Y3Z4W5V6U7T8S9R0Q
title: New Sheet
file: data.csv
range: A1
append: true
format: csv
Config file is searched in the following order:
--config
option
$CURRENT_DIR/.spreadit.yaml
$XDG_CONFIG_HOME/spreadit/.spreadit.yaml
$HOME/.config/spreadit/.spreadit.yaml
when $XDG_CONFIG_HOME
is not set
$HOME/.spreadit.yaml
YAML, JSON or TOML format is supported.
Requirements
spreadit
requires the Application Default Credentials (ADC) with below scopes
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/spreadsheets.readonly
See here for more details.
Install
You can install spreadit
using the following command:
go install github.com/haijima/spreadit@latest
MacOS users can install stool using Homebrew (See also haijima/homebrew-tap):
brew install haijima/tap/spreadit
or you can download binaries from Releases.
License
This tool is licensed under the MIT License. See the LICENSE
file for details.