I'm making a spreadsheet in Google Docs where i could track my data. I already have some starting values entered into cells, also some cells with functions. I wanted to make a script that would add these values in a list where are previous records.
To explain it more clearly.
I have a table with values:
[A1] [B1] [C1] [D1] etc.
[24.52] [12.84] [=A1-B1] [=(100/A1)*B1] etc.
After I press a button I want these values to be added in a list in another sheet (preferred) or in the same sheet just under everything I already have. These values in list shouldn't change anymore after I edit my main table.
List should be like this:
[.....] [.....] [.....] [......] <--- [...] that's where previous values were added
[24.52] [12.84] [11.68] [52.36%] <--- last added values
New data would be added in a new row.
I have a script but there is a problem with adding values to the cells. When I press that button it adds #NAME? in cells with comment "unknown range name A16" not their real values.
I use this script - This one only add new values to the same sheet:
function AddRecord() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
var lastRow = doc.getLastRow();
var cell = doc.getRange('A1').offset(lastRow, 0);
cell.setValue('=A16');
cell.offset(0, 1).setValue('=B16');
cell.offset(0, 2).setValue('=C16');
cell.offset(0, 3).setValue('=D16');
}
=A16, =B16, =C16, =D16 are cells that contain those values i need but how should i write this code that it would add them correctly?