Giter VIP home page Giter VIP logo

google-spreadsheet-2-json's Introduction

Google SpreadSheet -> JSON

An easy and quick way to get data from GoogleSpreadSheet

Install

npm i -S google-spreadsheet-2-json

Use

const googleSpreadsheet2json = require('google-spreadsheet-2-json');

googleSpreadsheet2json({
	spreadsheetID: '10FoJGSlPTjKOEuGnvx4e94HRRu2tEtwuhaZrgQgXsaE',
	credential: require('../../Private/readSpreadsheetsCredential.json'),
	maxRow: 200, // optional
	excludeSheets: [1, 2, 3, 4] //optional //starting in 0
}).then(sheets => {
	console.log(`done -> ${Object.keys(sheets).length} sheets`);
	Object.keys(sheets).map(key => {
		console.log(sheets[key]);
		console.table(sheets[key]);
	});
}).catch(err => console.log(err));

Examples

Spreadsheets used:

Help

  • The spreadsheetID can be obtained from the spreadsheet link: docs.google .com/spreadsheets/d/ 1lrW6tZfaIceqpsxmz59nQHmsWFfRsNAjLH_f8oaiNbY /edit#gid=1898934030

Get a credential

  1. Go to the Google Developers Console
  2. Select your project or create a new one (and then select it)
  3. Enable the Drive API for your project
  • In the sidebar on the left, expand APIs & services -> library
  • Search for "drive"
  • Click on "Drive API"
  • click the blue "Enable API" button
  1. Create a service account for your project
  • In the sidebar on the left, expand APIs & services > Credentials
  • Click blue "Add credentials" button
  • Select the "Service account key" option -> new service account type
  • Select the "JSON" key type option
  • Click blue "Create" button
  • your JSON key file is generated and downloaded to your machine (it is the only copy!)
  • note your service account's email address (also available in the JSON key file)
  1. Share the doc (or docs) with your service account using the email noted above

google-spreadsheet-2-json's People

Contributors

sturmenta avatar

Stargazers

Roman avatar Kelvin Zawadi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.