首页 > 解决方案 > Google表格根据单元格编号添加行具有值的单元格计数

问题描述

标签: javascriptgoogle-apps-script

解决方案


如果要添加新行,请尝试appendRow()方法。

例子:

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// Appends a new row with 3 columns to the bottom of the
// spreadsheet containing the values in the array
sheet.appendRow(["a man", "a plan", "panama"]);

还有更多方法可以测试,看看:

例子:

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
// Shifts all rows down by three
sheet.insertRows(1, 3);

推荐阅读