All Projects → FGRibreau → google-spreadsheet-cli

FGRibreau / google-spreadsheet-cli

Licence: other
📊 CLI for reading and writing data into Google Spreadsheet

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to google-spreadsheet-cli

Social-Media-Monitor
Automatically monitor and log fan counters from social media(Facebook Pages, Twitter, Instagram, YouTube, Google+, OneSignal, Alexa) using APIs to Google Spreadsheet. Very useful for website admins and social media managers.
Stars: ✭ 36 (-29.41%)
Mutual labels:  google-spreadsheet, spreadsheet
node-sheets
read rows from google spreadsheet with google's sheets api
Stars: ✭ 16 (-68.63%)
Mutual labels:  google-spreadsheet, spreadsheet
Luckysheet
Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.
Stars: ✭ 9,772 (+19060.78%)
Mutual labels:  google-spreadsheet, spreadsheet
spreadsheet
TypeScript/javascript spreadsheet parser, with formulas.
Stars: ✭ 40 (-21.57%)
Mutual labels:  spreadsheet, google-spreadsheets
OpenWebSheet
OpenSource Web based spreadsheet
Stars: ✭ 30 (-41.18%)
Mutual labels:  spreadsheet
xivtlsheet
ACT、FFLogsを使い、FF14 零式コンテンツのタイムラインスプレッドシートを作成
Stars: ✭ 39 (-23.53%)
Mutual labels:  spreadsheet
php-google-spreadsheet-api
PHP library for read/write access to Google spreadsheets via the version 3 API.
Stars: ✭ 38 (-25.49%)
Mutual labels:  google-spreadsheet
BulkPDF
BulkPDF is a free and easy to use open source software, which allows to automatically fill an existing PDF form with differen values. Only a spreadsheet (Microsoft Excel 2007/2010/2013, LibreOffice or OpenOffice Calc) with the desired values is required.
Stars: ✭ 94 (+84.31%)
Mutual labels:  spreadsheet
osu-cs-class-explorer
Angular-based web app allows OSU eCampus CS students to view candid class reviews from past students. Data scraped from OSU subreddit survey.
Stars: ✭ 24 (-52.94%)
Mutual labels:  spreadsheet
dynamic-table
Dynamic Table jQuery Plug-in - A table that can be sorted, filtered and edited, similar to common spreadsheet application.
Stars: ✭ 26 (-49.02%)
Mutual labels:  spreadsheet
react-gridsheet
React component like SpreadSheet
Stars: ✭ 121 (+137.25%)
Mutual labels:  spreadsheet
fast-formula-parser
Parse and evaluate MS Excel formula in javascript.
Stars: ✭ 341 (+568.63%)
Mutual labels:  spreadsheet
citybook
Create a resource directory from a contact spreadsheet.
Stars: ✭ 21 (-58.82%)
Mutual labels:  google-spreadsheet
binance-to-google-sheets
Google Spreadsheets add-on to get data directly from Binance API without any intermediaries! 🚀
Stars: ✭ 367 (+619.61%)
Mutual labels:  google-spreadsheets
account
📚️ ➕ 🔢 Tell little stories with numbers
Stars: ✭ 94 (+84.31%)
Mutual labels:  spreadsheet
lc-spreadsheets
Tidy data for librarians
Stars: ✭ 17 (-66.67%)
Mutual labels:  spreadsheet
spreadsheet-to-json
Convert Google Spreadsheets to JSON using Javascript
Stars: ✭ 53 (+3.92%)
Mutual labels:  google-spreadsheet
wowspreadsheet
World of Warcraft character tracking spreadsheet for Google Docs
Stars: ✭ 37 (-27.45%)
Mutual labels:  spreadsheet
anita
Anita is a private, no-server, powerful and fully customizable data management solution, open source and free of charge. With Anita you can organize any number of things you want to track, with one of our pre-configured Anita Templates or by defining your own custom data structure. Anita can handle many different data types, and can present your…
Stars: ✭ 30 (-41.18%)
Mutual labels:  spreadsheet
fxl.js
ƛ fxl.js is a data-oriented JavaScript spreadsheet library. It provides a way to build spreadsheets using modular, lego-like blocks.
Stars: ✭ 27 (-47.06%)
Mutual labels:  spreadsheet

📊 Google Spreadsheet CLI

Build Status Coverage Status deps Version Docker hub available-for-advisory extra Twitter Follow

❤️ Shameless plug

📢 Features

  • List worksheets
  • Add worksheet
  • Remove worksheet
  • Append a row to a worksheet
  • Automatically adds the header row if it's missing
  • Permissive JSON format through JSON5
  • Available as a docker image

🎩 Authentication

First thing first, you need your Google credentials, follow the authentication instructions there. Then save the JSON file somewhere, e.g. ~/myproject-8cbb20000000.json.

Locate the spreadsheet you want to work with, take the id from Google spreadsheet URL, e.g. 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw.

If you wish to directly pass the base64 stringified JSON as --credentials parameter you might first want to only keep client_email and private_key using jq.node like so:

export CREDENTIALS=$(cat ~/myproject-8cbb20000000.json | jq -r btoa 'pick(["client_email", "private_key"]) | JSON.stringify | btoa')

😇 Documentation

worksheets list

List spreadsheet document worksheets:

google-spreadsheet-cli \
  --id 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw \
  --credentials ~/myproject-8cbb20000000.json \
  worksheets list

{"id":"od6","title":"my first worksheet"}
{"id":"od7","title":"my second worksheet"}
{"id":"ad7","title":"oh oh oh the last one"}

... or you could also pass the credential as a JSON base64 encoded string:

google-spreadsheet-cli \
  --id 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw \
  --credentials $CREDENTIALS \
  worksheets list

{"id":"od6","title":"my first worksheet"}
{"id":"od7","title":"my second worksheet"}
{"id":"ad7","title":"oh oh oh the last one"}

worksheets add <title>

Add a worksheet to the spreadsheet document:

$ google-spreadsheet-cli \
  --id 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw \
  --credentials $CREDENTIALS \
  worksheets \
  add my_awesome_worksheet

{"id":"oy7n5ch","title":"my_awesome_worksheet","rowCount":50,"colCount":20,"url":"https://spreadsheets.google.com/feeds/worksheets/2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw/oy7n5ch"}

Other options:

  --spreadsheetId, --id   spreadsheet id, the long id in the sheets URL  [required]
  --credentials, --creds  json credential path (use environment variable to specify a JSON stringified credential in base64)  [required]
  --rowCount, --row       number of rows  [default: 50]
  --colCount, --col       number of columns  [default: 20]
  -h, --help              Show help  [boolean]

worksheets remove <worksheetId>

Remove a worksheet from the spreadsheet document:

$ google-spreadsheet-cli \
  --id 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw \
  --credentials $CREDENTIALS \
  worksheets \
  remove od6

{"status": "success"}

worksheets get --worksheetId {worksheetId} append --json

Append a row to a worksheet. Once you got the worksheetId it's really simple to append a row:

Passing raw JSON

$ google-spreadsheet-cli \
  --id 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw \
  --credentials $CREDENTIALS \
  worksheets \
  get --worksheetId od6 \
  append --json '{a:1, b:2, c:3}'

{"content":"b: 2, c: 3","title":"1","updated":"2017-04-26T21:46:22.201Z","id":"https://spreadsheets.google.com/feeds/list/2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw/od6/cpzh4"}

Note that the JSON data we passed was not strictly valid still it worked thanks to JSON5.

Passing base64 encoded JSON

As soon as you will have quotes or special characters inside your JSON, things are going to be messy. Fortunately you can also pass a base64 encoded JSON to --json.

$ JSON=$(echo '{a:1, b:2, c:3}' | base64)

$ echo $JSON
e2E6MSwgYjoyLCBjOjN9Cg==

$ google-spreadsheet-cli \
  --id 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw \
  --credentials $CREDENTIALS \
  worksheets \
  get --worksheetId od6 \
  append --json $JSON

{"content":"b: 2, c: 3","title":"1","updated":"2017-04-26T21:46:22.201Z","id":"https://spreadsheets.google.com/feeds/list/2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw/od6/cpzh4"}

Setup (docker 🐳)

Use this approach if you don't know/want to setup your NodeJS environment, that's what containers are good for.

# open ~/.bashrc  (or equivalent)
nano ~/.bashrc

# edit it
function google-spreadsheet-cli(){
 docker run -i --rm fgribreau/google-spreadsheet-cli:latest $@
}

# save it

# source it
source ~/.bashrc

# run it!
google-spreadsheet-cli \
  --id 2CVmfghQmkMdLct11Tfo0aqv1WtnPA-chuYDUMEvoVPw \
  --credentials $CREDENTIALS \
  worksheets \
  get --worksheetId od6 \
  append --json '{a:1, b:2, c:3}'

# done!

Setup (NodeJS)

npm i google-spreadsheet-cli -g

Changelog

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].