Socket
Book a DemoInstallSign in
Socket

gspreadreader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gspreadreader

Google SpreadSheet reader and parser

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

GSpreadReader

Google SpeadSheet Reader

Install

npm install gspreadreader --save

Example

const GSpread = require('gspreadreader');

setImmediate(async function() {
    const TODOSpread = new GSpread({
        id: '1J78UakpjTBUeFFPBmvcA7rolrlXf8PcWmrww5e1_JUs',
        tab: 1,
        titleHeader : true
    });
    await TODOSpread.getData().catch( E => console.trace(E) );

    console.log(TODOSpread.authors); // Array of author with name and email fields.
    console.log(TODOSpread.updated); // JS Date of last update.
    console.log(TODOSpread.title); // Sheet title!

    TODOSpread.rows.forEach( (task,id) => {
        if(id === "1") return;
        console.log('----------------');
        console.log(`name => ${task.name}`);
        console.log(`description => ${task.description}`);
        console.log(`max time => ${task.maxtime}`);
    }); 
});

The constructor take the google spreadsheet id, the tab id (default set to 1) and a optional argument 'titleHeader'.

When titleHeader is set to true, the code check the first Row and assign column id content as object key title. If set to false, the row is equal to an array.

Keywords

google

FAQs

Package last updated on 28 Jul 2017

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