🚀 Quick Installation
npm install -g kanmi-looker-cli
Or install as part of the complete KanmiLabs suite:
npm install -g kanmi-suite-cli
✨ Features
📋 List Reports
View all accessible Looker Studio reports with metadata, sharing settings, and access permissions.
📄 Export Reports
Download reports as PDF files or export metadata as JSON for backup and documentation.
📊 Clone Reports
Create copies of existing reports for templating, testing, or client customization workflows.
🔐 OAuth2 Authentication
Secure Google Drive API access with automatic token management and refresh handling.
🖥️ Cross-platform
Works seamlessly on macOS, Linux, and Windows with consistent behavior and performance.
🔄 Automation Ready
Perfect for CI/CD pipelines, scheduled reporting, and dashboard management automation.
🎯 Perfect For
📊 SEO/Performance Consultants
Manage multiple client dashboards, automate report delivery, and maintain dashboard templates efficiently.
👨💻 Development Teams
Integrate dashboard management into CI/CD workflows, backup important reports, and automate dashboard provisioning.
🏢 Enterprise Teams
Bulk manage organizational dashboards, implement governance workflows, and automate report distribution.
🔧 Setup Requirements
Prerequisites
- Node.js 14.0.0 or higher
- Google Cloud Project with Drive API enabled
- Access to Looker Studio reports (owner or viewer permissions)
- OAuth2 credentials configured for desktop application
Google Cloud Setup
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Drive API
- Create OAuth2 credentials:
- Go to APIs & Services → Credentials
- Create credentials → OAuth client ID
- Application type: Desktop application
- Download the JSON credentials file
- Configure OAuth consent screen (if required)
⚠️ Important: Looker Studio reports are managed through Google Drive, so you need Drive API access rather than a specific Looker Studio API.
Environment Configuration
# Create .env file
cp .env.example .env
# Edit with your credentials
GOOGLE_CREDENTIALS_PATH=/path/to/credentials.json
GOOGLE_TOKENS_PATH=/path/to/tokens.json
📖 Usage
Available Commands
| Command |
Description |
Key Options |
looker-cli auth |
Authenticate with Google Drive |
--reset, --credentials |
looker-cli list |
List accessible Looker Studio reports |
--format, --filter, --output |
looker-cli export |
Export report as PDF or metadata |
--id, --format, --output |
looker-cli clone |
Create a copy of existing report |
--id, --name, --folder |
looker-cli info |
Get detailed report information |
--id, --format |
Basic Examples
1. Authentication
looker-cli auth
Opens browser for OAuth flow and saves authentication tokens locally.
2. List All Reports
looker-cli list --format table
Displays a formatted table of all accessible Looker Studio reports with names, IDs, and last modified dates.
3. Export Report as PDF
looker-cli export \
--id "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" \
--format pdf \
--output "monthly-dashboard.pdf"
4. Export Report Metadata
looker-cli export \
--id "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" \
--format json \
--output "report-metadata.json"
5. Clone Report
looker-cli clone \
--id "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" \
--name "Q1 2024 Dashboard - Copy" \
--folder "Templates"
6. Filter Reports by Name
looker-cli list \
--filter "name:contains:Dashboard" \
--format json \
--output "dashboard-reports.json"
💡 Pro Tip: Use the --output flag to save results for automation scripts or further processing.
⚙️ Configuration Options
Environment Variables
# Required: Path to Google OAuth credentials
GOOGLE_CREDENTIALS_PATH=/path/to/credentials.json
# Optional: Custom token storage location
GOOGLE_TOKENS_PATH=/path/to/tokens.json
# Optional: Default output directory
LOOKER_OUTPUT_DIR=/path/to/exports
# Optional: Default export format
LOOKER_DEFAULT_FORMAT=pdf
Output Formats
table - Formatted table for console viewing
json - Structured JSON for programmatic use
csv - CSV format for spreadsheet import
pdf - PDF export (for export command only)
Filter Options
# Filter by name containing text
--filter "name:contains:Dashboard"
# Filter by exact name match
--filter "name:equals:Q1 2024 Report"
# Filter by modification date
--filter "modified:after:2024-01-01"
# Multiple filters (AND logic)
--filter "name:contains:Dashboard,modified:after:2024-01-01"
🔄 Automation Examples
Daily Report Backup Script
#!/bin/bash
# Daily backup script for important dashboards
# Create backup directory
mkdir -p "backups/$(date +%Y-%m-%d)"
# Export all dashboards as PDF
looker-cli list --format json | jq -r '.[].id' | while read id; do
looker-cli export --id "$id" --format pdf --output "backups/$(date +%Y-%m-%d)/$id.pdf"
done
# Export metadata for all reports
looker-cli list --format json --output "backups/$(date +%Y-%m-%d)/reports-metadata.json"
Client Dashboard Template Creation
#!/bin/bash
# Create client dashboards from templates
TEMPLATE_ID="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
CLIENT_NAME="New Client Corp"
# Clone template for new client
looker-cli clone \
--id "$TEMPLATE_ID" \
--name "$CLIENT_NAME - Performance Dashboard" \
--folder "Client Dashboards/$CLIENT_NAME"
echo "Dashboard created for $CLIENT_NAME"
Weekly Report Distribution
#!/bin/bash
# Weekly automated report distribution
DASHBOARD_ID="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
WEEK=$(date +%Y-W%U)
# Export current dashboard
looker-cli export \
--id "$DASHBOARD_ID" \
--format pdf \
--output "weekly-report-$WEEK.pdf"
# Send via email (requires mail setup)
# mail -s "Weekly Performance Report - $WEEK" team@company.com < weekly-report-$WEEK.pdf
🔄 Integration with Other Tools
CI/CD Pipeline Integration
# GitHub Actions example
name: Dashboard Management
on:
schedule:
- cron: '0 9 * * 1' # Every Monday at 9 AM
jobs:
backup-dashboards:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- run: npm install -g kanmi-looker-cli
- run: looker-cli list --output dashboards-list.json
- uses: actions/upload-artifact@v2
with:
name: dashboard-backups
path: "*.json"
Combine with Other KanmiLabs Tools
# Complete analytics workflow
# 1. Get GA4 data
ga4-cli report --property "123456" --output analytics-data.json
# 2. Get Search Console data
gsc-cli query --site "https://example.com" --output seo-data.json
# 3. Update dashboard with new data (manual step in Looker Studio)
# 4. Export updated dashboard
looker-cli export --id "dashboard-id" --format pdf --output "updated-report.pdf"
🚨 Troubleshooting
Common Issues
Authentication Errors
# Clear stored tokens and re-authenticate
looker-cli auth --reset
# Verify credentials file path
ls -la $GOOGLE_CREDENTIALS_PATH
Permission Issues
Ensure your Google account has appropriate access:
- Access to the Looker Studio reports (at least viewer permissions)
- Google Drive API enabled in your Google Cloud project
- OAuth consent screen configured (if using external users)
Export Failures
If exports fail, check:
- Report ID is correct and accessible
- Output directory exists and is writable
- Network connectivity for Google Drive API calls
- API quota limits not exceeded
Debug Mode
# Enable verbose logging
DEBUG=looker-cli* looker-cli list
# Check API response details
looker-cli info --id "report-id" --format json