従業員の人口統計を測定する企業のバランス スコアカードを計算するように設計された Google スプレッドシートがあります。スプレッドシートは、いくつかのデータ入力セルと、入力されたデータを計算してスコアを生成する特定の式を含む多数の「非表示」列で構成されています。
スプレッドシートの任意の行 (現在のカーソル位置) で実行するスクリプトが必要です: 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 セル) の上にある行の内容を、新しく作成された行にコピーする必要があります。