繁体   English   中英

添加多行Google Spreadsheet NPM

[英]Add multiple rows google-spreadsheet npm

我正在使用此npm google-spreadsheet来操作google电子表格,但没有找到像Google表格Api已经提供的那样一次添加多行的任何方法。

我已经使用过.addRow()方法,但是要添加多行,我需要运行效率低下的循环。 这里有谁遇到过类似的问题,仅使用此npm即可解决。

仅获取行并对其进行编辑并进行批量保存怎么样。

function workingWithCells(step) {
    sheet.getCells({
      'min-row': 1,
      'max-row': 5,
      'return-empty': true
    }, function(err, cells) {
      var cell = cells[0];
      console.log('Cell R'+cell.row+'C'+cell.col+' = '+cell.value);

      // cells have a value, numericValue, and formula
      cell.value == '1'
      cell.numericValue == 1;
      cell.formula == '=ROW()';

      // updating `value` is "smart" and generally handles things for you
      cell.value = 123;
      cell.value = '=A1+B2'
      cell.save(); //async

      // bulk updates make it easy to update many cells at once
      cells[0].value = 1;
      cells[1].value = 2;
      cells[2].formula = '=A1+B1';
      sheet.bulkUpdateCells(cells); //async

      step();
    });
  },

https://www.npmjs.com/package/google-spreadsheet

这对您有用吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM