I’m trying to create a function to pull data from google finance and have it automatically log data to multiple sheets of a document. I can’t seem to get it to add a function as a function it always adds it as text until i edit the cell
function addLog() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var numLastRows = rows.getLastRow();
sheet.appendRow(['2012/10/28','=b92','=c92','Log (auto)','','=index(GoogleFinance(C92,"price",A92);2;2)','','=h92','=i92','=j92','=k92']);
};
i couldn’t figure out how to make it reference the cell above (row 92 in this case) either 🙁
You will need to use the
setFormula()method rather thanappendRow(). Perhaps something like:To perform this action from the xth sheet through to the yth sheet (using zero-based index), I think the most efficient way would be: