我有一个谷歌电子表格,旨在为衡量员工人口统计数据的企业计算平衡记分卡。该电子表格由几个数据输入单元格和许多“隐藏”列组成,其中包含计算输入数据并产生分数的特定公式。
我需要一个脚本,它将位于电子表格中的任何行(当前光标位置):a)要从主菜单(插入行)调用的脚本 b)在当前光标位置下方插入用户定义的行数(弹出 UI要求插入行数的框) c) 从上面的行中复制数据,包括隐藏列中包含的所有数据/公式 d) 重新隐藏受保护的列,然后返回给用户。
隐藏的列包含我不希望用户看到的 IP,因此是隐藏/受保护的方面。
任何人都可以帮忙吗?
我的剧本到目前为止...
function onOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menuEntries = [{name: "Insert Rows", functionName: "doGet"}];
  ss.addMenu("User Functions", menuEntries);
}
function doGet(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var app =UiApp.createApplication().setTitle('Insert Rows').setHeight(75).setWidth(225);
  // Create a grid with 1 text box and corresponding label. 
  // Test entered into the text box is passed in to numRows.
  // The setName extension will make the widget available by the given name to the server handlers later.
  var grid = app.createGrid(1, 2);
  grid.setWidget(0, 0, app.createLabel('Number of Rows to Insert:'));
  grid.setWidget(0, 1, app.createTextBox().setName('numRows').setWidth(50));
  // Create a Vertical Panel and add the Grid to the Panel.
  var panel = app.createVerticalPanel();
  panel.add(grid);
  // Create a button and Click Handler.
  // Pass in the Grid Object as a callback element and the handler as a click handler.
  // Identify the function insertRows as the server click handler.
  var button = app.createButton('Submit');
  var handler = app.createServerHandler('insertRows');
  handler.addCallbackElement(grid);
  button.addClickHandler(handler);
  // Add the button to the Panel, add Panel to the App, launch the App
  panel.add(button);
  app.add(panel);
  ss.show(app);
}
function insertRows(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  var cursPos = sheet.getActiveCell().getRow();
  var valueRows = e.parameter.numRows;
  sheet.insertRowsAfter(cursPos, valueRows);
  var app = UiApp.getActiveApplication();
  app.close();
  return app;
}
我现在需要将当前活动单元格上方的行的内容(新创建的行的顶部 lh 单元格)复制到新创建的行中。