On the Submit Tab. In cell B2, I enter a ticker. The cell has a reference at C2 that searches for the ticker, name, sector, industry, sub-industry, price and market cap in the Universe tab using VLOOKUP. The Universe tab is a database of stocks. The cells C2:I2 get populated with the relevant information. The cells from J2:N2 are manually entered. Using cell references again the cells B4:N4 are populated. Once I have all the information on cells C4:N4, I have a script that I found (I have no prior experience with app scripts) which I run by clicking the “Submit” button on cell P3. This basically moves the data from cell C4:N4 to a new sheet ‘watchlist’. I repeat the process to add multiple tickers and stock information to the watchlist tab. This works perfectly however I’m facing a problem with the price and market cap in column F and G on the watchlist tab. The script does not seem to pick up the GOOGLEFINANCE formula that is used in the Universe tab from which the data is being looked up with the VLOOKUP function in the submit tab (H2:I2). Is there a way I could somehow implement the GOOGLEFINANCE function to show the real time price and market cap from the script or any other way so it could show up in the watchlist tab?
function Submit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sinput = ss.getSheetByName("Submit");
var soutput = ss.getSheetByName("Watchlist");
var input = [[sinput.getRange("C4").getValues(),
sinput.getRange("D4").getValues(),
sinput.getRange("E4").getValues(),
sinput.getRange("F4").getValues(),
sinput.getRange("G4").getValues(),
sinput.getRange("H4").getValues(),
sinput.getRange("I4").getValues(),
sinput.getRange("J4").getValues(),
sinput.getRange("K4").getValues(),
sinput.getRange("L4").getValues(),
sinput.getRange("M4").getValues(),
sinput.getRange("N4").getValues()]];
sinput.getRange("C4").clearContent(),
sinput.getRange("D4").clearContent(),
sinput.getRange("E4").clearContent(),
sinput.getRange("F4").clearContent(),
sinput.getRange("G4").clearContent(),
sinput.getRange("H4").clearContent(),
sinput.getRange("I4").clearContent(),
sinput.getRange("J4").clearContent(),
sinput.getRange("K4").clearContent(),
sinput.getRange("L4").clearContent(),
sinput.getRange("M4").clearContent(),
sinput.getRange("N4").clearContent(),
soutput.getRange(soutput.getLastRow()+1,
1,1,12).setValues(input);
soutput.insertRowAfter(soutput.getLastRow());
Logger.log(input);
}
Here are the screenshots as well as the file for reference: