How can I scrape from tiprank through Google Sheet Apps Script?
23:57 29 Jul 2021

I am using the following Google Sheet Apps Script to scrape tiprank for target price.

function TRTP(url) {
const html = UrlFetchApp.fetch(url).getContentText();
const res = html.match(/
.+?()/); if (!res) throw new Error("Value cannot be retrieved.") return res; }

I am using the following URL: https://www.tipranks.com/stocks/msft/forecast

This is trying to pull data from the following snapshot from URL above.

Targetprice from Tiprank:
Targetprice from Tiprank

This should give me a long OuterHTML in which values are also present .. I use Google Sheet formula to extract target price from that.

This work on other websites like WSJ but is not working on Tiprank.

google-sheets google-apps-script web-scraping urlfetch