monoctl is a Go-based CLI tool to manage configuration, data sources, and Google Sheets integrations from the command line.
It lets you define reusable data sources (MongoDB, SQL, etc.) and push their data directly into Google Sheets.
- Config files are stored in the OS config directory:
~/.config/monoctl/config.yml - Data sources are saved as YAML files in:
~/.config/monoctl/data-sources/<type>/<name>.yml - Sheets require a Google service account JSON file.
--rowsaccepts 2D JSON arrays for inserting multiple rows.--data-sourcepulls data directly from a saved data source (MongoDB, MariaDB, etc.).
sudo wget -O /usr/local/bin/monoctl https://github.com/salmanwaheed/monoctl/releases/download/v0.2/monoctl-linux-x86_64
sudo chmod +x /usr/local/bin/monoctl
# verify installation
monoctl versionRequirements: Go, Git, Make.
git clone https://github.com/salmanwaheed/monoctl.git
cd monoctl
make build
# verify installation
./bin/monoctl versionShow monoctl version information.
monoctl version
monoctl version --format "{{json .}}" # JSON output
monoctl version --format "{{yaml .}}" # YAML output
monoctl version --format "{{.}}" # default Go templateManage monoctl global configuration.
monoctl config set <key> <value> # Set a config value
monoctl config unset <key> # Remove a config value
monoctl config get <key> # Get a config value
monoctl config list # List all config values
monoctl config list --format "{{json .}}"
monoctl config list --format "{{yaml .}}"
monoctl config list --format "{{.}}"Manage reusable data source definitions.
Allowed operators:
eq, ne, gt, gte, lt, lte, in, nin, regex, exists.
# Create a data source
monoctl data-source create <type>/<name> \
--uri "mongodb://<host>:27017/<db_name>?ssl=true" \
--table <collection> \
--limit 10 \
--select 'f1,f2,...' \
--sort '{"k1":"desc|asc"}' \
--filter '{"k1":"v1","k1":{"gte":"2025-12-17T11:00:00+04:00"}}' \
--overwrite
monoctl data-source delete <type>/<name> # Delete a data source
monoctl data-source view <type>/<name> # View data source YAML
monoctl data-source view <type>/<name> --dry-run # Execute and preview data
monoctl data-source list # List all data sourcesInsert rows into a Google Sheet.
monoctl sheet \
--id <sheet_id> \
--tab-name <sheet_name> \
--auth /path/to/google-service-account.json \
--data-source <type>/<name>monoctl sheet \
--id <sheet_id> \
--tab-name <sheet_name> \
--auth /path/to/google-service-account.json \
--rows '[["name","email"],["Salman","salman@example.com"]]'monoctl data-source create mongodb/users \
--uri mongodb://localhost:27017/db \
--table users \
--limit 10 \
--select 'name,email' \
--sort '{"name":"desc"}' \
--filter '{"active":true}'monoctl sheet \
--id 1LEh1... \
--tab-name Sheet1 \
--auth google-service-account.json \
--data-source mongodb/usersmonoctl uses a Google Service Account to authenticate and write data to Google Sheets.
Follow these steps once to generate the required JSON file.
- Go to Google Cloud Console https://console.cloud.google.com/
- Click Select Project → New Project
- Enter a project name and click Create
- In the Cloud Console, open APIs & Services → Library
- Search for Google Sheets API
- Click Enable
- Go to APIs & Services → Credentials
- Click Create Credentials → Service Account
- Enter:
- Name:
monoctl-readonly-access - Role: (Skip or choose Viewer - not required here)
- Click Done
- In Credentials, click the service account you just created
- Go to the Keys tab
- Click Add Key → Create new key
- Select JSON
- Download the file and save it securely
Example:
~/.config/monoctl/google-service-account.json
- Open your Google Sheet in a browser
- Click Share
- Copy the client email (looks like:
monoctl-readonly-access@<project_id>.iam.gserviceaccount.com) - Paste it into the Share dialog
- Set permission to Editor
- Click Send
- You do NOT need OAuth or browser login
- Service accounts work server-to-server
- Do NOT commit the JSON file to Git
- Recommended permissions: Editor only on required sheets
- You can reuse the same service account json file for multiple sheets
- 403 Permission Denied → Sheet not shared with service account email.
- Invalid credentials → Wrong JSON file or corrupted key.
- API not enabled → Enable Google Sheets API in Cloud Console.
- Refactor commands, flags, and internal structure.
- Load default command flag values from config.
- Add Google Sheets integration with MariaDB as a data source.
- Add Google Drive support for downloading and storing HTML pages.
- Add
--query-from /path/to/query.json. - Add
--rows-from /path/to/rows.json. - Support multiple
--rowflags:--row "name,email,telephone" \ --row "salman,salman@example.com,123456789"
- Enforce
monoctl help <command>and removemonoctl --help.