Assumptions:
- Your new inputs are in
input!A1
and input!B1
; and
- Your outputs will by in
output!A
and output!B
.
You can write a script by clicking on Tools on the menu and entering Script Editor.
Then write this function:
function writeData() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var input = ss.getSheetByName("input")
.getRange(1, 1, 1, 2)
.getValues();
var outputSheet = ss.getSheetByName("output");
var numRows = outputSheet.getLastRow();
outputSheet.getRange(numRows + 1, 1)
.setValue(input[0][0]);
outputSheet.getRange(numRows + 1, 2)
.setValue(input[0][1]);
}
Next, set up a trigger. Within Script Editor, under Resources, select Current project's triggers and then set up your trigger. If you want it to run weekly, use a time-driven trigger. You can also set a spreadsheet-driven trigger to run on every edit. Save everything.
If you don't want to use automatic triggers, you can execute the writeData()
function by adding an item on the menu bar of the spreadsheet:
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [];
menuEntries.push({name: "Write data", functionName: "writeData"});
ss.addMenu("Custom functions", menuEntries);
}
Save, and if you refresh the spreadsheet you'll see a new item on the menu bar.