npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kanmi-looker-cli

v1.0.1

Published

CLI tool for managing Looker Studio reports via Google Drive API

Readme

kanmi-looker-cli

A powerful command-line interface for managing Looker Studio reports via Google Drive API. Perfect for SEO/performance consultants, dev teams, and dashboard automation workflows.

🚀 Features

  • List Reports: View all accessible Looker Studio reports
  • Export Reports: Download reports as PDF or JSON
  • Clone Reports: Create copies of existing reports
  • OAuth2 Authentication: Secure Google Drive API access
  • Cross-platform: Works on macOS, Linux, and Windows

📋 Prerequisites

Before using looker-cli, you need to:

  1. Create Google Cloud Project & Enable Drive API:

    • Go to Google Cloud Console
    • Create a new project or select an existing one
    • Enable the Google Drive API
    • Create OAuth 2.0 credentials (Desktop application)
  2. Get OAuth Credentials:

    • Go to APIs & Services > Credentials
    • Create credentials > OAuth client ID
    • Application type: Desktop application
    • Download the credentials JSON file

🔧 Installation

Install from npm (Coming Soon)

npm install -g looker-cli

Install from Source

git clone <repository-url>
cd looker-cli
npm install
npm run build
npm link

⚙️ Setup

  1. Configure Environment Variables:

    cp .env.example .env
  2. Edit .env file:

    CLIENT_ID=your-google-client-id
    CLIENT_SECRET=your-google-client-secret
  3. First Run Authentication:

    looker-cli list

    This will open your browser for OAuth authentication and store the token securely.

🎯 Usage

List All Reports

looker-cli list

Sample Output:

🔍 Listing Looker Studio reports...

Found 3 report(s):

┌─────────────────────────────────────────────────────────────────────────────┐
│ TITLE                           │ FILE ID                    │ LAST MODIFIED │
├─────────────────────────────────────────────────────────────────────────────┤
│ SEO Performance Dashboard       │ 1ABC123DEF456GHI789JKL012... │ 12/15/2024   │
├─────────────────────────────────────────────────────────────────────────────┤
│ Monthly Analytics Report        │ 2BCD234EFG567HIJ890KLM123... │ 12/10/2024   │
├─────────────────────────────────────────────────────────────────────────────┤
│ Client Campaign Dashboard       │ 3CDE345FGH678IJK901LMN234... │ 12/08/2024   │
└─────────────────────────────────────────────────────────────────────────────┘

Export Reports

# Export as PDF (default)
looker-cli export --id 1ABC123DEF456GHI789JKL012MNO345PQR

# Export as JSON metadata
looker-cli export --id 1ABC123DEF456GHI789JKL012MNO345PQR --format json

# Specify output path
looker-cli export --id 1ABC123DEF456GHI789JKL012MNO345PQR --output ./reports/dashboard.pdf

Clone Reports

looker-cli clone --id 1ABC123DEF456GHI789JKL012MNO345PQR --name "My Client Report Copy"

🔐 Authentication & Security

  • Token Storage: Tokens are stored securely in ~/.looker-cli/token.json with 600 permissions
  • OAuth2 Flow: Uses Google's installed application OAuth2 flow
  • Scope: Requests minimal required permissions (https://www.googleapis.com/auth/drive.readonly)

Token Management

# Tokens are automatically refreshed
# To manually revoke and re-authenticate, delete the token file:
rm ~/.looker-cli/token.json

🛠️ Development

Build from Source

npm install
npm run build

Run in Development Mode

npm run dev -- list
npm run dev -- export --id YOUR_FILE_ID

Project Structure

src/
├── commands/
│   ├── list.ts      # List reports command
│   ├── export.ts    # Export reports command
│   └── clone.ts     # Clone reports command
├── utils/
│   ├── auth.ts      # OAuth2 authentication
│   └── drive.ts     # Google Drive API integration
└── index.ts         # CLI entry point

🔍 API Limitations

Looker Studio & Drive API

  • Report Detection: Looker Studio reports don't have a specific MIME type in Drive API
  • Search Strategy: Uses keyword matching (looker, data studio, dashboard, report)
  • Export Limitations:
    • PDF export works for most Google Drive files
    • JSON export provides metadata only
    • Full report data extraction requires Looker Studio's native export

Workarounds

  1. Better Report Detection: Name your reports with clear keywords
  2. Full Data Export: Use Looker Studio's built-in export for complete data
  3. Automation: Combine with other tools for complete workflow automation

🚨 Troubleshooting

Common Issues

1. "CLIENT_ID or CLIENT_SECRET missing"

  • Ensure .env file exists with correct credentials
  • Check that environment variables are set properly

2. "Token invalid or expired"

  • Delete token file: rm ~/.looker-cli/token.json
  • Run any command to re-authenticate

3. "File not found or not accessible"

  • Verify file ID is correct
  • Ensure you have access to the file
  • Check if file was moved or deleted

4. "No reports found"

  • Make sure your reports contain keywords like "looker", "dashboard", "report"
  • Check if reports are in your Google Drive account
  • Verify Drive API permissions

Debug Mode

# Enable verbose logging
DEBUG=* looker-cli list

📊 Use Cases

For SEO/Performance Consultants

  • Export client reports for offline analysis
  • Create template reports for new clients
  • Automate report generation workflows

For Development Teams

  • Clone dashboard templates for different environments
  • Export reports for version control
  • Integrate with CI/CD pipelines

For Dashboard Automation

  • Batch export reports for archiving
  • Create backup copies of important dashboards
  • Migrate reports between accounts

🔄 Roadmap

  • [ ] Audit Command: Summary of all reports with metadata
  • [ ] Open Command: Open reports in browser
  • [ ] Diff Command: Compare two reports
  • [ ] Batch Operations: Process multiple reports
  • [ ] Output Formats: CSV, Markdown support
  • [ ] Report Templates: Create from templates
  • [ ] Scheduling: Cron-like report exports

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📝 License

MIT License - see LICENSE file for details

🔗 Links

📞 Support

For issues and feature requests, please use the GitHub issue tracker.


Happy reporting! 📊✨