GithubHelp home page GithubHelp logo

spreadsheetdb-for-google_apps_script's Introduction

SpreadsheetDB

What's SpreadsheetDB?

  • This Script can be Spreadsheet as a DB for Google Apps Script.
  • It can do select/insert/update/delete Row(s) on Spreadsheet by query.
  • It can full text query to Spreadsheet rows.

How it work?

  • It use List Base Feed on Google Spreadsheet API.

How use it?

  • You can use it as a Library
  • Library ID: MlMEyCNWeCV97wefWrBRcEQV62A3znfOO
  • Do you need code assist? You can use mock library and mini hack for code assist.
  • Mock Library ID: MORnDiFLK6dWUCyoTNsS1HQV62A3znfOO
  • Use both adobe library ids and write below code.
    var spreadsheetService = GSSDB.createService(spreadsheetId , consumerKey , consumerSecret);
    //var spreadsheetService = SpreadsheetService; it's hack for gas editor. you can do code assist after code.

Example

Initializer

var spreadsheetService = GSSDB.createService(ss.getId());
//if you need set ConsumerKey and ConsumerSecret
var spreadsheetService = GSSDB.createService(ss.getId() , "consumerKey" , "consumerSecret");
  • args1 spreadsheet id
  • args2 consumerKey
  • args3 consumerSecret

insert row.

var entry = {
  "id":1,
  "name":"soundTricker"
};

var entry2 = {
  "id":2,
  "name": "soundTricker2"
};

//insert
//If your need insert row, you user insert method
spreadsheetService.insert(ss.getSheets()[0].getName(), entry);
  • arg0 : sheetName
  • arg1 : insert object, {column : value}

select row(s).

var rows = spreadsheetService.query(ss.getSheets()[0].getName(), ""); //if you need all rows,arg1 set empty string.

//maybe rows length is 2, and rows[0]'is 1, rows[1]'id is 2
//query result always return as a array. if result length is 1.
var row = spreadsheetService.query(ss.getSheets()[0].getName() , "id=1");
  • arg0 : sheetName

  • arg1 : query. query reference is http://code.google.com/intl/ja/apis/spreadsheets/data/3.0/reference.html#ListParameters

  • arg2 : advanceObject

  • if you need sorted result or revesed result or full-text query,you set advanceObject.

  • advanceObject field is

    { orderby : "column:columnName" ,//Specifies what column to use in ordering the entries in the feed. reverse:true/false , // Specifies whether to sort in descending or ascending order. q: full-text-query for rows };

update row

spreadsheetService.update(ss.getSheets()[0].getName() , row[0]);
  • arg0 : sheetName
  • arg1 : update object. it shoud be selected object by query method.

delete row

spreadsheetService.deleteEntry(ss.getSheets()[0].getName() , row[0]);
  • arg0 : sheetName
  • arg1 : delete object. it shoud be selected object by query method.

if you update sheetName or add sheet. you should call refleshListKey method

 spreadsheetService.refleshListKey();

spreadsheetdb-for-google_apps_script's People

Contributors

soundtricker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spreadsheetdb-for-google_apps_script's Issues

Error in query method

spreadsheetService.query(sheetName, keyword)で一致する行がないと「に対するリクエストに失敗し、コード 400 が返されました。サーバーの応答: 解析エラー: Invalid token encountered (line 303)」エラーになります。

なにも考慮しないとscriptが終了してしまいます。
何かよいハンドリング方法はありますか?

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.