CLI (command-line utility) for Google Sheets
23rd February 2021I added commands to deal with spreadsheets in watermint toolbox release 85. With these commands, you can export data from Google Sheets as CSV or JSON. Or, update Google Sheet with CSV file from the command line.
The tool runs on multiple platforms without complex dependencies. Just download & extract executable file from the archive. Currently, the tool run on Windows (x86/amd64), Linux (x86), and macOS (amd64).
Exporting data
To retrieve data from Google Sheet, run the following command.
$ tbx services google sheets sheet export -id GOOGLE_SHEET_ID -range SHEET_NAME
If you want to specify output path, please add -data PATH_TO_EXPORT
option. Please see more detail about the command at the command manual.
(Sorry for the long command name. Because the tool now has 200+ commands. :-)
Importing data
To import data from CSV, run the following command.
$ tbx services google sheets sheet import -id GOOGLE_SHEET_ID -range SHEET_NAME -data DATA_FILE_PATH
The command changes only cell values. Please see more detail about the command at the command manual.
More commands
The latest release contains a few more commands to deal with Google Sheets.
- services google sheets sheet append – Append data to the sheet.
- services google sheets sheet clear – Clear values of the sheet.
- services google sheets sheet list – List sheets of the spreadsheet
- services google sheets spreadsheet create – Create a new spreadsheet.
Note:
The registration to Google is currently verification in progress.
You may see the warning on the authorization screen. Please verify safety before proceed it.