Code Monkey home page Code Monkey logo

google-spreadsheet-reader's Introduction

google-spreadsheet-reader

Converts a Google SpreadSheet to a pretty JSON.

Home

Install

$ npm install google-spreadsheet-reader

Preparation

Publish to the web

Select [File > Publish to the web…]

Publish to the web

Click [Publish]

Start publish

Done!

Published

Customize documents

After toggle [Published content & settings], select documents you want to publish. Then click [Start publishing]

Custom documents

Stop publishing

After toggle [Published content & settings], click [Stop publishing]

Stop publish

Usage

Example

For example, see this spreadsheet example.

Get key

Use the key from the URL.

Copy key

var SpreadSheet = require('google-spreadsheet-reader');

// Create SpreadSheet Object
var spreadSheet = new SpreadSheet('1lBbCRh6N2Ozz8oEB9fIRN4vuUNQhErqGbAQbHAu2w5Q');

Basic example:

spreadSheet.load()
  .then(function(res) { console.log(res); }) // beautiful JSON!
  .catch(function(err) { console.error(err.message); }); // Aw, something happened.

Result:

Copy key

Options:

You can change the property names to camelCase by setting the camelcase flag to true.

spreadSheet.load({ camelcase: true })
  .then(function(res) { console.log(res); }) // JSON with camelcased properties!
  .catch(function(err) { console.error(err.message); });

Result:

Copy key

Represent data types

You can represent JSON data types with the following spreadsheet configurations.

int / float / number

Add type next to property. (e.g. Population: int)

Continents

Array / JSON

For array, split items with | (e.g. Genotype: array)

Blood Type

Convert page items to object

You can create an object type and with the first column, define its properties.

Add : object next to the first property. (e.g. id: object)

Copy

google-spreadsheet-reader's People

Contributors

mayognaise avatar

Watchers

 avatar  avatar  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.