jpillora / node-edit-google-spreadsheet

A simple API for editing Google Spreadsheets
304 stars 101 forks source link

Feature: Row API (List-based Feeds) #59

Open jpillora opened 9 years ago

jpillora commented 9 years ago

Looking for Contributors Please look through these notes and then the source and if you decide to give this a shot, mention that you're working on this in the comments below and I'll give you push access.


Currently, this module only uses cell-based feeds, though there is also a row-based REST API: https://developers.google.com/google-apps/spreadsheets/#working_with_list-based_feeds. I haven't researched too deep into the REST API, though I think it would result in a module API like:

//add a new 'row' property
spreadsheet.rows.get(function(err, rows) {
  //get all rows
});

spreadsheet.rows.query({my:"query"}, function(err, rows) {
  //get specific rows
});

spreadsheet.rows.add({name:"foo",age:25}, function(err, newRow) {
  //insert a row
});

//each of the row objects above have:
row.update({name:"bar"}, function(err) {
   //updates this row inplace
});
row.delete(function(err) {
  //deletes this row and shifts up
});

Read through the docs and comment on the proposed API above, I may have missed something.

If the worksheets API feature is also being done, the rows object would a go inside each worksheet, and then be aliased from spreadsheet.