New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

object-to-google-spreadsheet

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-to-google-spreadsheet

Push an array of unstructured data objects into a Google spreadsheet

  • 1.0.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-44.44%
Maintainers
1
Weekly downloads
 
Created
Source

Quickly publish a set of unstructured JSON objects into a Google spreadsheet that you specify.

Installation

NPM Info

Example usage

const O2GS = require('object-to-google-spreadsheet');

// require your Google json credentials file
const creds = require('./creds');

const myReport = new O2GS(creds, '<Your docKey here>');

const options = {
    sheetName: 'My Awesome Report',
    rowName: 'person', // (optional) the key name of the base of your rows
    properties: 'properties', // (optional) the field containing your base's properties
    a1Field: 'details', // (optional) the value of the A1 field
    sort: true, // (optional) sort fields row alphabetically
    removeBase: false // (optional) if true, the base column won't be rendered in the sheet
};

// input must be an array of your objects
const docs = [
    {
        person : "John",
        properties : {
            Age: 25,
            Address : "16 main st."
        }

    },
    {
        person : "Jane",
        properties : {
            Age : 24,
            Hobbies : ["swimming", "Javascripting"]
        }

    }
];

// push your object to the sheet
myReport.push(docs, options)
.then(result => console.log(result))
.catch(err => console.log(err));

// using async/await
(async ()=> {
    try {
        await myReport.push(docs, options);
    } catch(err) {
        console.log(err);
    }
    })();

Example result

updated sheet

docKey

Creds

  1. Go to the Google Developers Console
  2. Select or Create Project
  3. Dashboard > Enable APIs and Services > Enable the Drive API for your project
  4. Credentials > Create Service Account Key
  5. Select Json Key type and save the downloaded json file to your project
  6. Once you have created the services account, you will have an email xxx@xxx.iam.gserviceaccount.com. Go to your Google Sheets file and shared the edit permission to the email address.
  7. For more details, please refer to https://www.npmjs.com/package/google-spreadsheet

Author

Ehab Khaireldin

License

This project is licensed under the MIT License and built for OneMeter.com

Keywords

FAQs

Package last updated on 26 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc