[英]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.