https://github.com/kren1/tosheets
Send your stdin to google sheets
https://github.com/kren1/tosheets
command-line google-sheets google-spreadsheet pipe python stdin
Last synced: 17 days ago
JSON representation
Send your stdin to google sheets
- Host: GitHub
- URL: https://github.com/kren1/tosheets
- Owner: kren1
- License: mit
- Created: 2017-11-15T14:02:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-14T18:50:47.000Z (almost 5 years ago)
- Last Synced: 2025-03-14T04:17:45.335Z (about 1 month ago)
- Topics: command-line, google-sheets, google-spreadsheet, pipe, python, stdin
- Language: Python
- Size: 24.4 KB
- Stars: 543
- Watchers: 16
- Forks: 28
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A simple command line utility that sends your stdin to sheets.
Available on pip by `pip install tosheets` (python3+ only)
***NOTE:*** On first use, tosheets will open a browser window to authorize OAuth2 token.
## Using `tosheets`
Pipe a local file to a new spreadsheet.
```
cat data.csv | tosheets -c A1 -d , --new-sheet="tosheetsSheet"
```Pipe a local file to an existing spreadsheet:
(Given a URL like `https://docs.google.com/spreadsheets/d/sample-spread-sheet-id-23sdf32543fs/edit#gid=0`)
```
cat data.csv | tosheets -c B4 -d , --spreadsheet=sample-spread-sheet-id-23sdf32543fs
```Send sequence from 1 to 10 to a column starting at B4:
```
seq 1 10 | tosheets -c B4 --spreadsheet=sample-spread-sheet-id-23sdf32543fs
```Send a matrix:
```
1 2
3 4
```
To the same location:```
echo -e '1 2\n3 4' | tosheets -c B4 --spreadsheet=sample-spread-sheet-id-23sdf32543fs
```To sheets has a variety of other options listed:
```
tosheets, send stdin to your google sheetsUsage:
tosheets -c [-u] [-k] [-s ] [--spreadsheet=] [--new-sheet=] [-d ] [-q ]
tosheets (-h | --help)
tosheets --versionOptions:
-h --help Prints help.
--version Show version.
-i CSV Read this CSV instead of stdin
-u Update CELL(s) instead of appending.
-k Keep fields as they are (do not try to convert int or float).
-c CELL Start appending to CELL.
-s SHEET Use sheet name SHEET, otherwise tries to use
TOSHEETS_SHEET (default: first visible sheet).
-d DELIMITER Use DELIMITER to split each line (default: whitespace).
-q QUOTE_CHAR A one-character string used to quote fields containing special characters,
such as the delimiter or quotechar, or which contain new-line characters.
(default: '"').
--spreadsheet= Send to the spreadsheet identified by spreadshetId
(ie. docs.google.com/spreadsheets/d//...),
if empty uses TOSHEETS_SPREADSHEET enviroment variable.
--new-sheet= Create a new spreadsheet with the chosen name. Prints the
spreadsheetId so it can be piped/stored.
--open Open a browser with the newly created sheet
```### Distribution
```
python setup.py sdist bdist_wheel
twine upload dist/*
```