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 🙏

© 2024 – Pkg Stats / Ryan Hefner

connectif-2-g-sheets

v0.0.6

Published

CLI to automate upload or append Data Explorer Report to Google Sheets

Downloads

4

Readme

connectif-2-g-sheets

This CLI (Command Line Interface) allows generating and downloading Data Explorer reports from Connectif, and then uploading them to Google Sheets. It is ideal for automating the data extraction and spreadsheet update process.

Features

  • Easily add Connectif Data Explorer reports to Looker Studio, Power BI, or other, by setting up the Google Sheet as a data source.
  • Generates reports from Connectif using the API.
  • Downloads and extracts ZIP files containing the reports in CSV format.
  • Uploads CSV data to Google Sheets, allowing both the creation of new sheets and updating existing ones.

Requirements

Installation

  1. Install the NodeJs runtime.

  2. Now, from your favourite shell, install the CLI by typing the following command:

$ npm install -i connectif-2-g-sheets -g

Usage

The CLI offers several configurable options through the command line:

connectif-2-g-sheets -k -c -s -r -f -o -t [options]

Options

  • -k, --apikey : Connectif API key (required).
  • -c, --credentials : Path to the Google JSON credentials file (required).
  • -s, --spreadsheetid : Destination Google Sheets spreadsheet ID (required).
  • -r, --reportid : Connectif report ID (required).
  • -f, --filename : Renamed CSV file name (required).
  • -o, --fromdate : From date to send report in YYYY-MM-DD format (required).
  • -t, --todate : To date to send report in YYYY-MM-DD format (required).
  • -d, --destination : Destination path to download and extract the ZIP file (required).
  • -n, --newspreadsheet: Add data to a new Google Sheet (optional, default false).
  • -a, --append: Append data to an existing spreadsheet without overwriting previous data (optional).
  • -e, --existingsheet : Name of the existing sheet to which data will be appended (optional, requires -a).

Usage Example:

connectif-2-g-sheets -k YOUR_CONNECTIF_API_KEY -c ./path/to/credentials.json -s YOUR_SPREADSHEET_ID -r YOUR_REPORT_ID -f report.csv -o 2023-01-01 -t 2023-01-31 -n -d 'C:\Users\YOUR_USER'

This command will generate a report for January 2023, download and extract it, and then upload the data to a new sheet in Google Sheets.

connectif-2-g-sheets -k YOUR_CONNECTIF_API_KEY -c ./path/to/credentials.json -s YOUR_SPREADSHEET_ID -r YOUR_REPORT_ID -f report.csv -o 2023-01-01 -t 2023-01-31 -a -e SHEET_NAME -d 'C:\Users\YOUR_USER'

This command will generate a report for January 2023, download it, extract it and then upload it to an existing sheet called SHEET_NAME adding the report data.

Notes

  • The range between fromDate and toDate cannot be greater than 31 days.
  • Ensure that the Google credentials file has the necessary permissions to access and modify Google Sheets.
  • Ensure that the Google Sheets file is shared with the email address of the service account associated to the Google Sheets API Key.
  • You can find the spreadsheet ID in a Google Sheets URL: https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0
  • You can find the Connectif report ID in a Data Explorer URL: https://eu1.connectif.cloud/store/00000000000000/data-explorer-report/connectifReportId
  • The script automatically handles downloading and extracting the ZIP file from Connectif.