Goal: The goal is to grab the shiller PE from this website and to put it in a google sheet that updates every 24 hours.
Website: https://www.gurufocus.com/sector_shiller_pe.php
The table on the website with "shiller pe" values that needs to be scraped
Live values needed to be put in this google sheet
Solutions Tried:
Tried to use this function in the spreadsheet, but it is just unable to grab the website because the website is too slow
Made this script to grab the HTML of the data and return the shiller value for the Energy sector:
function energyFinder() {
var url = "https://www.gurufocus.com/sector_shiller_pe.php";
const html = UrlFetchApp.fetch(url).getContentText();
var regex = new RegExp(/\/mq5xwwf">26<\/a><\/b><\/u><\/td><td class="text_center">([0-9][0-9].[0-9][0-9])<\/td>/);
var e = regex.exec(html);
return e
Logger.log(e)
}
But this just returns null. Any solution would help, thanks!
ps new to the website so I cannon embed pictures yet, so sorry for that
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.