Feature: Worksheet API

Abierto
#56 8 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
javascript
Área
api

Línea de trabajo

Empieza leyendo metadata.js y el código fuente circundante de Spreadsheet.load, send y receive. Compara el modelo actual con el prototipo propuesto y, después, define la colección de hojas de cálculo y el comportamiento de carga/creación/eliminación. Se considera terminado cuando se representan varias hojas de cálculo, la hoja de cálculo actual sigue siendo compatible con versiones anteriores y la lista de hojas de cálculo se mantiene actualizada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement help wanted

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.


A spreadsheet is the entire document, and a worksheet is a tab in the document. Currently this module models 1 spreadsheet and 1 worksheet, it should actually model N worksheets, just as spreadsheets do. The proposed feature would result in the API below. Please +1 below so we can gauge interest. I've specified a rough outline of the changes that need to be made, though they're subject to change.

A few initial notes:

  • Adding and deleting spreadsheets is out of scope, see the google-drive module
  • The metadata.js will be come worksheet.js since metadata is actually a worksheet API call
  • The Metadata class would be become a Worksheet class
  • On Spread.load all of the spreadsheets worksheets should be instantiated in spreadsheet.worksheets and if (now optional) worksheetName was set, then it would be set to spreadsheet.worksheet (the current worksheet).
  • Important To make this change backwards compatible spreadsheet.send()/receive() actually call spreadsheet.worksheet.send()/receive()
  • Finally, there's new APIs to add and remove worksheets
    • spreadsheet.load(title, callback(err, worksheet)) (If it's already in worksheets no request is needed, otherwise it will refresh the worksheet list. On success worksheet becomes the new current spreadsheet.worksheet)
    • spreadsheet.create(title, [numColumns, numRows], callback(err, worksheet)) (Operates as an "upsert" – adds if necessary. On success worksheet becomes the new current spreadsheet.worksheet)
    • spreadsheet.delete(title, callback(err))
    • As these calls are made spreadsheet.worksheets is being kept up to date

See prototype code:

Spreadsheet.load({
  username: creds.username,
  password: creds.password,
  spreadsheetName: 'node-edit-spreadsheet',
  worksheetName: 'Sheet1'  //worksheet becomes optional
}, function run(err, spreadsheet) {
  if(err) throw err;

  spreadsheet.worksheets === [ /* worksheet instances */, /* */ ];
  spreadsheet.worksheet === { /* Sheet1 instance */ };

  //now
  spreadsheet.send();
  spreadsheet.receive();
  //actually does
  spreadsheet.worksheet.send();
  spreadsheet.worksheet.receive();

  //and there's now 'load', 'create' and 'delete' methods

  spreadsheet.load("Sheet 3", function(err, worksheet) {
    //...
  });

  spreadsheet.create("Sheet 2", function(err, worksheet) {
    //...
  });

  spreadsheet.delete("Sheet 1", function(err) {
    //...
  });

});
Lenguaje dominante
JavaScript
Estrellas
301
Forks
98
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de jpillora/node-edit-google-spreadsheet

Todos los issues de jpillora/node-edit-google-spreadsheet

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.