Git Product home page Git Product logo

apostrophe-google-spreadsheet's Introduction

Apostrophe Google Spreadsheet

Apostrophe Google Spreadsheet allows you to connect a spreadsheet in Google Drive with your MongoDB, convert/sync the data at your whim and query the collection later on.

Configuration

In your app js. Just initialize it in apostrophe-site as you would any other module

modules: {
  'apostrophe-ui-2': {},
  'apostrophe-people': {},
  'apostrophe-groups': {},
  'apostrophe-editor-2': {},
  'apostrophe-redirects': {},
  'apostrophe-google-spreadsheet': {
    spreadsheetID: 'xxxxxxxxxxxxx',
    authEmail: 'xxxxxxxxxxxx',
    keyPath: __dirname + '/auth/spreadsheet.pem'
  },
  'apostrophe-pie-charts': {}
}

Required options

You absolutely need to specify a spreadsheetID, authEmail and keyPath in order for this module to work. Not sure how to get those? This article is incredibly helpful: http://www.nczonline.net/blog/2014/03/04/accessing-google-spreadsheets-from-node-js/

Usage

1. Use it as a command line task

$ node app apostrophe:sync-google-spreadsheet

2. Hit the /sync route with an ajax call or in browser

localhost:3000/apos-google-spreadsheet/sync

By default, the data is stored in a mongo collection called "aposSheets". If you'd like this to be something different, just specify a collectionName in your options when initializing the module.

Be aware that each time you run a sync, the collection is dropped and then populated by your new spreadsheet data. There is no updating. Only total destruction and then repopulation (for now).

Accessing the data from other modules

You can query your aposSheets collection in the same way you would with apostrophe-snippets based modules (events, maps, etc.).

var sheet = self.site.modules['apostrophe-google-spreadsheet'];

self.app.get('/sheet-json', function(req, res) {
  return sheet.get({}, {}, function(err, docs){
    // do something with your json or whatever!
    return res.send(docs);
  });
});

To - Do

Create aposLocal "aposSpreadsheetsMenu" and necessary templates to include sync button the admin bar

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.