I am making a Google Sheets app that reads column A which has a stock symbol and puts the price in the column to the right using =GOOGLEFINANCE
I have this refreshing every day and appending to the column between A and B with its date code in B1.
Whenever it refreshes, the data is copied as opposed to new data being added. It seems like it is adding the formula itself to the spreadsheet as opposed to putting in the value itself.
Here is my code
function myFunction() {
SpreadsheetApp.getActiveSheet().insertColumns(2);
SpreadsheetApp.getActiveSheet().getRange('B1').setValue('=now()');
SpreadsheetApp.getActiveSheet().getRange('B2:B10').setValue('=iferror(GOOGLEFINANCE(A2:A10,"price"),"")');
}